Re: Imports awareness in Imported modules problem

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Fredrik Lundh

    Re: Imports awareness in Imported modules problem

    Mohamed Yousef wrote:
    why am i doing this in the first place
    I'm in the process of a medium project where imports of modules start
    to make a jungle and i wanted all needed imports to be in a single
    file (namely __init__.py)
    and then all imports are made once and other modules feel it
    Python doesn't use a global namespace -- importing a given module into
    one module doesn't make it visible everywhere else (and trust me, this
    is a very good thing).

    (it uses a global module cache, though, so it's only the first import
    that actually loads the module)
    my goal is basically making W() aware of the re module when called
    from A
    to do that, add "import re" to the top of the C module.

    see this page for a little more on Python's import mechanism:



    </F>

Working...