Show/hide output model in Python script


I’m trying to implement a function where the user is able to show and hide the output model compared to the input model. For example, when a user presses 1, the input model (before the effect of the dynamicModel) shows. When a user presses 2, the input model gets cut by the planes, and the output node is then shown.

What would be the easiest way to do this?
I’ve not dealt with vtkMRMLDynamicModelNode so this is quite new to me. My initial thought was to use SetVisibility function to show/hide the DisplayNode but then dynamic model node does not seem to have a displaynode

Dynamic modeler nodes specify the operation type and all inputs, and outputs. You thought it correctly that you need to call SetVisibility of model display nodes. You can get the display nodes by calling GetDisplayNode() method of the input and output model nodes referenced in the dynamic modeler node.