<div dir="ltr"><div><div>Hi,<br><br></div>I think that ParaView's python package should provide a mechanism to import all vtk modules. The site-packages/paraview/vtk directory includes .py files for each vtk module, but the __init__.py file only imports a subset of them. As far as I can tell, it's up to the user to import individual modules by name.<br>
<br></div>Here's a code snippet that inspects the site-packages/paraview/vtk directory and imports all vtk*.py files.<br><br><div><br>import os<br>import glob<br><br>try:<br></div><div> # this works for vtkpython<br>
</div><div> from vtk import *<br><br>except ImportError:<br><br></div><div> # this works for pvpython<br></div><div> import paraview.vtk<br> baseDir = os.path.dirname(paraview.vtk.__file__)<br> for f in glob.glob(os.path.join(baseDir, 'vtk*.py')):<br>
moduleName = os.path.splitext(os.path.basename(f))[0]<br> exec('from paraview.vtk.%s import *' % moduleName)<br><br><br></div><div>I usually put this code into a file named vtkAll.py and then my scripts can do:<br>
<br></div><div>import vtkAll as vtk<br><br>And that will work with vtkpython and pvpython.<br></div><div><br><br></div><div>Pat<br></div></div>