I would like to run a command in Python Shell to execute a file with an argument.
execfile("abc.py") but how to add 2 arguments?
execfile runs a Python file, but by loading it, not as a script. You can only pass in variable bindings, not arguments.
If you want to run a program from within Python, use
subprocess.call(['./abc.py', arg1, arg2])
import sys sys.argv = ['arg1', 'arg2'] execfile('abc.py')
Note that when
abc.py finishes, control will be returned to the calling program. Note too that
abc.py can call
quit() if indeed finished.