test1.py is the main script calling another script test2.py by passing the same argument list that has been passed to test1.py. I have done following but it reads the sys.argv list as string and parse into multiple arguments and also includes unnecessary [ and ,
test1.py
import os
import sys
argList=sys.argv[1:]
os.system('python another/location/test2.py %s'%(argList))
test2.py
import sys
print(sys.argv[1:])
Call test1.py
python test1.py -a -b -c
output: ['[-a,' ,'-b,', '-c]' ]
Please post if there is a better opti
argListconverted into? It's not quite what you expect. You want some way to formatargListyourself...look into thejoinmethod of a string.