Reload Python Algorithm through Python Shell

Hi everyone!

I’m currently looking for a way to reload a python algorithm through the python shell

At the moment, I’m able to trigger a reload using the following:

python_algorithm = FindSource("PythonAlgorithmExample")
python_algorithm.SMProxy.RecreateVTKObjects()

but the import fails:

Warning: In vtkSIPythonSourceProxy.cxx, line 421
vtkSIPythonSourceProxy (000002428C49E620): Failed to re-import module 'SideFlipPlugin'.

Does anyone know how to proceed?

python_algorithm.SMProxy.RecreateVTKObjects() eventually calls vtkSmartPyObject pvdetail(PyImport_ImportModule("paraview.detail.pythonalgorithm"));, where the following error is produced:

Traceback (most recent call last):
  File "C:\Users\TK3D-\AppData\Local\Programs\Python\Python39\Lib\importlib\__init__.py", line 168, in reload
    raise ModuleNotFoundError(f"spec not found for the module {name!r}", name=name)
ModuleNotFoundError: spec not found for the module 'SideFlipPlugin'

but somehow, reloading the Python Module through the UI command button does not have this error :thinking:

I dont think this is supported. please open an issue: https://gitlab.kitware.com/paraview/paraview/issues

Thank you for your response, Mathieu!

I’ve created an issue in ParaView here: https://gitlab.kitware.com/paraview/paraview/-/issues/22530