>>>>> Slawomir Nowaczyk <[EMAIL PROTECTED]> (SN) wrote:
>SN> Hello, >SN> Let's say I have a module "emacs", defining function eexecfile(file): >SN> def eexecfile(file): >SN> # do other stuff >SN> execfile(file,globals()) >SN> # do other stuff >SN> Now, assume I have file test.py containing an assignment "x=1" >SN> If I run python and do: >SN> import emacs >SN> emacs.eexecfile("test.py") >SN> print emacs.x # works, x was put in module namespace >SN> print x # doesn't work, x is not defined in main script namespace >SN> What is the best way to make "print x" work? Using the following: emacs.py: def eexecfile(file, glob): # do other stuff execfile(file,glob) main: import emacs emacs.eexecfile("test.py", globals()) print x -- Piet van Oostrum <[EMAIL PROTECTED]> URL: http://www.cs.uu.nl/~piet [PGP 8DAE142BE17999C4] Private email: [EMAIL PROTECTED] -- http://mail.python.org/mailman/listinfo/python-list