I run a specific module using the terminal like this: Slicer.exe --python-code selectModule('MyModule').
Now, the code of the module take arguments (-t), and I try to run the module just adding: Slicer.exe --python-code selectModule('MyModule') -t 44
But it doenst work, the argument is not taken (‘NoneType’), so its possible to run a module with arguments in this way? and which is the correct syntax?
You can then simply list all the commands you want to launch at startup, separated by semicolons. If you want to submit many commands or you would like to avoid messing with proper quotation marks and indentation then you can specify a Python script filename to launch at startup.
If you want to interact with the application after it is started (load more data, remove data, etc) then you can use Slicer’s REST API.
There is a Python package - slicerio - that you can pip install very easily into any Python environment that allows you to start Slicer, load data, view data, export data, etc. using a few simple Python function calls. If you find that some features are missing then feel free to add them and submit pull requests.
You can use --python-code to specify all parameters and actions by multiple Python commands, separated by semicolons, quoted if contains spaces. For example:
Alternatively, you can use --python-script to specify a launcher script and set each additional parameter as a separate command-line argument. You can parse the arguments using Python argparse as usual. For example: