Open a slicer module with python

I want to open my custom scripted module every time I open Slicer.

I know that I have to edit the .slicerrc.py file, but I don’t know what lines of code to put in there.

As an example I add this to the command line when I start slicer:

--python-code "selectModule('WebServer')"

But you can put the same in .slicerrc.py, maybe using slicer.util.selectModule for style purposes.

1 Like

The Slicer script repository has many python examples that may be helpful for you. One includes setting the slicer module for startup.

https://slicer.readthedocs.io/en/latest/developer_guide/script_repository.html#set-a-new-default-module-at-startup

1 Like

Using the GUI, you can go to Settings->Modules and set the Default startup module from the list of loaded modules. Here I have set “OpenIGTLinkIF” as my new default.

2 Likes