# Why importing vtkmodules.vtkRenderingVolumeOpenGL2 is mandatory?

**URL:** https://discourse.vtk.org/t/why-importing-vtkmodules-vtkrenderingvolumeopengl2-is-mandatory/16107
**Category:** Web
**Created:** [October 22, 2025, 6:35pm UTC](https://discourse.vtk.org/t/why-importing-vtkmodules-vtkrenderingvolumeopengl2-is-mandatory/16107 "2025-10-22T18:35:02Z")
**Posts on this page:** 3
**Page:** 1

<div class="post-metadata">

### Author: ![BotellaA](https://discourse.vtk.org/user_avatar/discourse.vtk.org/botellaa/32/1243_2.png) [@BotellaA](https://discourse.vtk.org/u/BotellaA)
#### Post date: [October 22, 2025, 6:35pm UTC](https://discourse.vtk.org/t/why-importing-vtkmodules-vtkrenderingvolumeopengl2-is-mandatory/16107/1 "2025-10-22T18:35:02Z")

</div>

I have a simple VTKWeb app with a pytest integration. It works when I import every vtk object using import vtk.

I am trying to control the import better by importing directly from vtkmodules. Now the test is failing with this error: _websocket.\_exceptions.WebSocketConnectionClosedException: Connection to remote host was lost_. It works only if I import vtkmodules.vtkRenderingVolumeOpenGL2, which is not related to the app.

Here is a simple repo: [GitHub - BotellaA/ReproduceVtk](https://github.com/BotellaA/ReproduceVtk)

By commenting this line, the project no longer works: [ReproduceVtk/src/test\_repo/vtk\_protocol.py at main · BotellaA/ReproduceVtk · GitHub](https://github.com/BotellaA/ReproduceVtk/blob/main/src/test_repo/vtk_protocol.py#L5)

I do not understand this behavior.

Thanks for the help.

---

<div class="post-metadata">

### Author: ![user27182](https://discourse.vtk.org/user_avatar/discourse.vtk.org/user27182/32/10104_2.png) [@user27182](https://discourse.vtk.org/u/user27182)
#### Post date: [October 22, 2025, 7:25pm UTC](https://discourse.vtk.org/t/why-importing-vtkmodules-vtkrenderingvolumeopengl2-is-mandatory/16107/2 "2025-10-22T19:25:09Z")

</div>

This is explained here:

> **[Python Wrappers - VTK documentation](https://docs.vtk.org/en/latest/advanced/PythonWrappers.html#factories-and-implementation-modules)**

> This import is needed because `vtkRenderingOpenGL2` provides the OpenGL implementations of the classes in `vtkRenderingCore`

---

<div class="post-metadata">

### Author: ![BotellaA](https://discourse.vtk.org/user_avatar/discourse.vtk.org/botellaa/32/1243_2.png) [@BotellaA](https://discourse.vtk.org/u/BotellaA)
#### Post date: [October 22, 2025, 7:28pm UTC](https://discourse.vtk.org/t/why-importing-vtkmodules-vtkrenderingvolumeopengl2-is-mandatory/16107/3 "2025-10-22T19:28:00Z")

</div>

Nice! Thanks for the link!
