Cannot import name 'vtkMRMLMarkupsLineNode' from 'slicer' for ParameterNode definition

Hello Slicer community! I am trying to make a simple Slicer (5.6.2) extension that requires the user to select a markup line from a dropdown list. I use the Qt designer to create a qMRMLNodeComboBox and set nodeTypes to vtkMRMLMarkupsLineNode. The example extension .py file created by the Extension Wizard includes a section for “Parameter Node” specification (wrapped with @parameterNodeWrapper) that type checks input parameters. I specify that the inputVolume is of type vtkMRMLScalarVolumeNode with inputVolume: vtkMRMLScalarVolumeNode. The vtkMRMLScalarVolumeNode type is imported from slicer with from slicer import vtkMRMLScalarVolumeNode. This works as expected.

However, when I try to specify the type of another parameter inputLine of type vtkMRMLMarkupsLineNode with inputLine: vtkMRMLMarkupsLineNode and add vtkMRMLMarkupsLineNode to the slicer import statement, I get an error upon launching Slicer that says Cannot import name 'vtkMRMLMarkupsLineNode' from 'slicer'. What am I missing here?

I don’t think you need this. Simply use slicer.vtkMRMLMarkupsLineNode.

What you tried should work. Make sure that you don’t have any typos in the name; I am forever accidentally typing vkt instead of vtk, or you might miss the s in Markups. I doublechecked that there’s nothing funny about vtkMRMLMarkupsLineNode specifically: the following imports without error for me on Slicer 5.6.1

from slicer import (
    vtkMRMLScalarVolumeNode, 
    vtkMRMLMarkupsROINode, 
    vtkMRMLMarkupsLineNode, 
    vtkMRMLMarkupsFiducialNode, 
    vtkMRMLSegmentationNode
)

@cpinter’s suggestion should work equivalently well
inputLine: slicer.vtkMRMLMarkupsLineNode
The import really just saves you having to type slicer. all the time.