Is there a way for a python script to load and use environment modules? os.system(\'module load xxx\')
doesn\'t work since it executes them in a subshell (at le
While the accepted solution works, I found it to be easier to write:
import sys
sys.path.insert(0, '/path/to/environment/modules')
# Environment modules become available by loading python.py (the name choice could be better here)
import python as mod
# ...
mod.module('use', '/some/dir')
mod.module('load', 'program/1.2.3')
This looks more pythonic to me and also it allows IDEs to offer auto-completion etc.