Python/VTK import style

I may be answering my own question to some extent, but I’m used to importing VTK functionality into Python as:

import vtk

however I see a lot of examples and test code using import lines like this:

from vtkmodules.vtkCommonCore import vtkPoints

I do see this page indicating that it is experimental API, but this page looks like I should start migrating my code to use it … will import vtk be deprecated any time soon?

Unlikely; it is far too wide-spread to start kicking out warnings at this point. The main benefit is that vtkmodules imports way faster because you import only what is needed.

To future readers, if you are trying to migrate to the from vtkmodules style, you can figure out what module a vtk object is in using Python’s online help:

>>> help(vtk.vtkCellArray)

Help on class vtkCellArray in module vtkmodules.vtkCommonDataModel:
# ... etc. ...