3 of 3
replaced http://stackoverflow.com/ with https://stackoverflow.com/
user avatar
user avatar
You could use a multiline string so that the environment is modified in the same shell process:
from subprocess import check_call
check_call("""
source /etc/profile.d/modules.sh
module purge
module load intel
./my_code
""", shell=True, executable="/bin/bash")
jfs
- 417.3k
- 211
- 1k
- 1.7k