call py from py

David Fraser davidf at
Wed Jun 30 23:15:24 CEST 2004

Alberto Vera wrote:
> Hello:
> Could you tell me How I Can call a python program from another one?
> Regards

If you want to run another python program from within a python program 
rather than just calling functions in another module, you can use the 
builtin function execfile. help(execfile) gives the details:

Help on built-in function execfile:

     execfile(filename[, globals[, locals]])

     Read and execute a Python script from a file.
     The globals and locals are dictionaries, defaulting to the current
     globals and locals.  If only globals is given, locals defaults to it.


More information about the Python-list mailing list