call one python script from within another
Gerhard Häring
gh at ghaering.de
Fri Jul 11 18:04:54 EDT 2003
Tubby Tudor wrote:
> What is the best way to call one python script from within another
> python script? For example:
>
> one.py finishes succesfully and calls two.py which finishes OK and then
> calls three.py
Unless you need different processes, it's better to just create one
application with several functions, like this:
#v+
def one():
pass
def two():
pass
def three():
pass
def main():
one()
two()
three()
main()
#v-
If you *really* need to execute Python scripts from within Python, you
can use execfile(). If you want to execute arbitrary programs and wait
for their completion, you can use the system() function in the os module.
-- Gerhard
More information about the Python-list
mailing list