I want to run a python script from another python script. Where I pass in variables as I would at command line.
So for example I would run my first script that would iterate thru a list of values 0,1,2,3 and past those to the 2nd script "script2.py 0" then "script2.py 1", etc.
I found SO 1186789 which is a similar question but ars's answer calls a function, where as I want to run the whole script not just a function. And balpha's answer calls the script but with no args. I altered this to something like the below as a test:
execfile("script2.py 1")
But is is not accept vars properly. When I print out the 'sys.argv' ins script2.py it is the original command call to first script "['C:\script1.py'].
I don't really want to change the original script (i.e. script2.py in my example) since I don't own it.
I figure there must be a way to do this just confuse as to how.
Thanks!