Integrating VTK with PyQT

Hi. I am using vtk in my pyQt project.
The issue I’m encountering is puzzling because the error doesn’t occur every time. Do you have any ideas on what might be causing this and how to diagnose it?

Here is the relevant code snippet of the creation of my viewer:

class myViewer(QVTKRenderWindowInteractor):
        def __init__(self, parent=None):
        super().__init__(parent) 
        self.Init_view()


    def Init_view(self):
        self.Initialize()
        self.Start()
        self.renderer = vtkRenderer()
        self.GetRenderWindow().AddRenderer(self.renderer)

        self.interactor = self.GetRenderWindow().GetInteractor()
        self.interactor.SetInteractorStyle(self.style_2d) 
                 
        self.renderer.ResetCamera()
        self.show()

The following is the results in the terminal:

  File "C:\Users\.conda\envs\vtkenv\lib\site-packages\vtkmodules\qt\QVTKRenderWindowInteractor.py", line 473, in 
resizeEvent
    self._Iren.SetSize(w, h)
  File "C:\Users\.conda\envs\vtkenv\lib\site-packages\vtkmodules\qt\QVTKRenderWindowInteractor.py", line 416, in 
__getattr__
    elif hasattr(self._Iren, attr):
  File "C:\Users\.conda\envs\vtkenv\lib\site-packages\vtkmodules\qt\QVTKRenderWindowInteractor.py", line 416, in 
__getattr__
    elif hasattr(self._Iren, attr):
  File "C:\Users\.conda\envs\vtkenv\lib\site-packages\vtkmodules\qt\QVTKRenderWindowInteractor.py", line 416, in 
__getattr__
    elif hasattr(self._Iren, attr):
  [Previous line repeated 987 more times]
  File "C:\Users\.conda\envs\vtkenv\lib\site-packages\vtkmodules\qt\QVTKRenderWindowInteractor.py", line 414, in 
__getattr__
    if attr == '__vtk__':
RecursionError: maximum recursion depth exceeded in comparison

Thanks in advance for your help! :blush: