469,356 Members | 2,013 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,356 developers. It's quick & easy.

call py from py

Hello:

Could you tell me How I Can call a python program from another one?

Regards
Jul 18 '05 #1
2 2250
Alberto Vera wrote:
Could you tell me How I Can call a python program from another one?


Just import the other module and call a function from it?
Or use os.system or whatever.

More info needed for better answers.

--Irmen
Jul 18 '05 #2
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(...)
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.

David
Jul 18 '05 #3

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

35 posts views Thread by hasho | last post: by
13 posts views Thread by mitchellpal | last post: by
7 posts views Thread by archana | last post: by
46 posts views Thread by Steven T. Hatton | last post: by
3 posts views Thread by cberthu | last post: by
9 posts views Thread by CryptiqueGuy | last post: by
1 post views Thread by CARIGAR | last post: by
reply views Thread by suresh191 | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.