[Tutor] help needed with using exec
Kent Johnson
kent37 at tds.net
Thu Nov 11 22:38:02 CET 2004
André Roberge wrote:
> Dear Tutors,
>
> Suppose I have in file test.py a single line:
> move()
>
> which is a function define in otherApp.py
>
> After reading the content of "test.py" into
> the string named code, I would like to do
>
> "exec code"
>
> and have it execute move() as it is defined
> in otherApp from myApp
>
> Within myApp, I have
> instance = otherApp()
>
> I have tried hardcoding the following in myApp:
> ==
> move = instance.move
> move()
> ==
> and it workd.
>
> I then tried
> ==
> exec code
> ==
> by itself and it didn't work.
what about this?
move = instance.move
exec code
If that doesn't work, please post a short, complete program and the
exact error message you are getting when you run it.
Kent
More information about the Tutor
mailing list