I’m looking for a way to load/unload LMOD modules from a python script. I thought I found the answer here:
that mentions python init script in LMOD, but it doesn’t seem to fully work. First I add directory with the init script to the PYTHONPATH variable
export PYTHONPATH=${PYTHONPATH}:$LMOD_DIR/…/init
then after opening python I run
from env_modules_python import module
From that commands like module(‘av’) and module(‘list’) work and produce expected output. But loading modules does not work:
module(‘load MATLAB’)
module(‘list’)
No modules loaded
Furthermore, it seems like the problem is with any command that has arguments, e.g.
module(‘av MATLAB’)
produces help page instead of a list of MATLAB modules.
Anyone knows how to fix this issues and load LMOD modules from a python script?