afaik, Slicer does not inherit the system’s environment variables at startup, does it? If so, where does the python kernel in Slicer read its PYTHONPATH environment variable from? I have a few convenience functions which I currently have to import manually in the python console after every startup via:
import sys
sys.path.append("/path/to/my/utility/code")
For my native python kernel (anaconda env) in my OS (Mac), I put that info into ~/.bash_profile:
export PYTHONPATH=/path/to/my/utility/code:$PYTHONPATH
in order to access my custom code in all projects.
So, two questions:
Is there an equivalent I can do for Slicer, such that my utility paths are loaded at startup?
I regularly replace my Slicer nightly build with the latest version. Apart from “losing” all my extensions, I would then lose this path as well. Is there a way to make ideally both (extensions and PYTHONPATH) persistent?
That’s great, many thanks for the quick response!
About question 2: Is there any way to restore my extensions and my additional module paths after installing a new version of Slicer (e.g. a new nightly build), i.e. making them persistent? If not, I will keep re-loading/re-entering them manually.
Again, many thanks for your help!