Calling Python Code Snippets within Python Application

Gerhard Häring gh at
Mon Apr 14 15:58:32 CEST 2003

Marc Floessel <gildemere at> wrote:
> This is very likely a newbie question, but I'd still appreciate a
> pointer. I need to call Python Code snippets (saved in a file/database
> etc) within my main Python Application. I would like to do the
> following things: [...]
> In which direction should I look?

The "execfile" builtin function.

while you're at it, you might want to look at "exec" and "eval", too.
Unlike the functions "eval" and "execfile", "exec" is a statement, btw.

-- Gerhard

More information about the Python-list mailing list