In python, we can do: slicer.util.getModuleLogic(name) and getModuleLogic. Is there an equivalent in C++? For example, when loading a MRML scene, in the UpdateScene callback, I’d like to make sure a module exists and has been properly loaded. I would also like to know if the GUI for that module is shown.
Since it would be in the Node::UpdateScene, is there a path from the scene pointer to find the application’s logic and from there find the module’s logic? Or, is there a registry accessible via a static methods to all the loaded modules?
If your module depends on a module (the module class returns the list of dependencies in the dependencies() method) then tou don’t need to check if that module exists. Slicer would not initialize your module if any of the dependencies were missing.
Whether a module has a GUI, has it been created, or shown yet is a private business of that module. In general, a module should not directly access or manipulate another module’s GUI in any way. Instead, your module can modify the MRML scene and other modules can observe those changes. You can also call methods in any other module’s logic.
Why would you need to know if another module’s GUI is shown?
Nodes are only for data storage, so you don’t initiate any module logic operations from there. Instead, your module logic can observe scene changes and perform operations in response.