I want to run slicer from within python, to execute a script that builds a scene automatically from a JSON file telling it what files to load. I think I’ve solved everything except how to tell slicer the location of the JSON file. There are several options I can think of:
Slicer --python-script myscript.py, first setting an environment variable
json_filethat is then checked by myscript.py.
Slicer --python-code mymodule.myscript(<json_file>), where my code inserts the correct string for <json_file> before running slicer
- Same as above, but run
Slicer -cinstead of
All of these feel pretty kludgy for something that seems like it would be common. Is there some other way I’m not thinking of? Is there a preferred way to give arguments when running a python script within Slicer as part of a batch job?