how can I use exec with main module globals?

Akathorn Greyhat akathorn at
Sat Jul 12 15:15:36 EDT 2008

Hello, this is my first message in the group.

I'm spanish so my english sometimes is really bad, sorry =(

I have a problem and I hope someone has the answer.

I'm trying to make an in-game python idle, it works great but the exec
statement can't access the main module globals but only the ones that are
inside the module in wich I defined the function.

    def execute(self, string):
        exec(string, globals(), globals())

I realized that if I move the code to the main module, It works, but I want
it to be inside another script.

So my question is, how can I make the exec statement access the main

Akathorn Greyhat
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <>

More information about the Python-list mailing list