Executing a python script with arguments from a python script

Larry Bates larry.bates at websafe.com
Tue Dec 13 01:37:14 CET 2005

You can pass arguments into a python script, see getopt module.
Then to call an external script you would use subsystem module
(or os.system if you are on earlier version of python).

If you can, just make the other python program into a
function and import it as James Stroud suggests in a separate

olaufr at gmail.com wrote:
> Hi,
> I need to call a python script, with command line arguments (it is an
> autonomous script with a __main__), from within another python script.
> Can I use exec() or execfile() for this? How to pass the arguments?
> Thanks,
> Olivier.

More information about the Python-list mailing list