How to check if MathText is supported without importing all of vtk?

If I do:

import vtkmodules.vtkRenderingFreeType
vtkmodules.vtkRenderingFreeType.vtkMathTextFreeTypeTextRenderer().MathTextIsSupported()

It returns False

But if I do instead:

import vtk
vtk.vtkMathTextFreeTypeTextRenderer().MathTextIsSupported()

It returns True.

I understand there are some factory classes that must be imported to do some magic: Python Wrappers - VTK documentation

import vtkmodules.vtkRenderingFreeType is listed as one of those magic imports, but yet importing this alone doesn’t seem to be enough. I also tried importing all three magic imports:

import vtkmodules.vtkRenderingFreeType
import vtkmodules.vtkRenderingOpenGL2
import vtkmodules.vtkInteractionStyle
vtkmodules.vtkRenderingFreeType.vtkMathTextFreeTypeTextRenderer().MathTextIsSupported()

But this still returns False.

What other imports are needed to make this work without importing everything? I can probably manually try importing each module one at a time but maybe someone knows the answer without needing to brute force this?

>>> import vtkmodules.vtkRenderingFreeType
>>> import vtkmodules.vtkRenderingMatplotlib
>>> vtkmodules.vtkRenderingFreeType.vtkMathTextFreeTypeTextRenderer().MathTextIsSupported()
True

In VTK, math text is implemented via matplotlib. So for math text to work, matplotlib must be installed, and vtkRenderingMatplotlib must be imported.

These implementation modules (RenderingOpenGL2, RenderingMatplotlib) can definitely be a headache.

Thank you so much! import vtkmodules.vtkRenderingMatplotlib indeed was the missing link. I didn’t even know such a module existed.