[Tutor] exec syntax
alan.gauld at btinternet.com
Tue May 8 15:29:24 CEST 2007
"Rikard Bosnjakovic" <rikard.bosnjakovic at gmail.com> wrote
>> I can see how to use it to execute a script of code embedded in the
>> (that example was provided in the documentation) but I cannot
>> figure out the
>> syntax to use it to run another python program in another file.
> Use execfile().
But use it with caution, its usually the wrong thing to be doing.
Why do you need to run another python program from
within your python program? Is it not usable as a module?
There are valid cases for execfile - otherwise it wouldn't exist! :-)
But they are fairly rare.
More information about the Tutor