I\'m trying to automate a process using python. If I am just in the terminal the workflow looks like:
user:> . /path/to/env1.sh
user:> python somethin
subprocess calls (particular Popen) accepts an env argument which is a mapping of environement variables to values. You can use that. e.g.
env = {'FOO': 'Bar', 'HOME': '/path/to/home'}
process = subprocess.Popen(['python', 'something.py'], env=env)
Of course, usually, it's better to just call some functions after *import*ing something.py instead of spawning a whole new process.