python calling python

Larry Whitley ldw at us.ibm.com
Tue Aug 22 11:00:22 EDT 2000


I'm sure the answer to this is straightforward, but I can't find it in the
documentation.

How does one call python from python?  For example:  If the main() in
myProgram1.py wants to call the main() in myProgram2.py with parameters,
what incantation should it use?

I'm trying to use ...

os.system( "python /myPath/myProgram2.py -myparm1 xxx -myparm2 yyy" )

...from myProgram1 but it doesn't seem to work.  (It appears to re-enter
main() in myProgram1 with myProgram2's parms).

Larry






More information about the Python-list mailing list