I have a series of scripts I am automating the calling of in python with subprocess.Popen
. Basically, I call script A, then script B, then script C and so forth.
Script A sets a bunch of local shell variables, with commands such as set SOME_VARIABLE=SCRIPT_A
, set PATH=%SCRIPT_A:/=\;%PATH%
.
Script B and C then need to have the effects of this. In unix, you would call script A with "source script_a.sh
". The effect lasts in the current command window. However, subprocess.Popen effectively launches a new window (kind of).
Apparently subprocess.Popen
is not the command I want to do this. How would I do it?
edit I have tried parsing the file (which is all 'set' statements) and passing them as a dictionary to 'env' in subprocess.Popen, but it doesn't seem to have all worked..