Error importing __init__ declared variable from another package

Jason Veldicott jasonveldicott at gmail.com
Tue Feb 28 02:55:18 EST 2012


Hi,

I have a simple configuration of modules as beneath, but an import error is
reported:

/engine
   (__init__ is empty here)
   engine.py
/sim
   __init__.py


The module engine.py imports a variable instantiated in sim.__init__ as
follows:

   from sim import var_name
   var_name.func()

The following error messaged is received on the func() call above (Eclipse
PyDev):

"undefined variable from import: func"

Any idea why this is causing an error?
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-list/attachments/20120228/d619b399/attachment.html>


More information about the Python-list mailing list