Python Wildcard Import Vs Named Import

Posted by Dan on Stack Overflow See other posts from Stack Overflow or by Dan
Published on 2010-04-19T17:48:51Z Indexed on 2010/04/19 17:53 UTC
Read the original article Hit count: 784

Filed under:
|
|
|

Ok, I have some rather odd behavior in one of my Projects and I'm hoping someone can tell me why. My file structure looks like this:

MainApp.py
res/
  __init__.py
  elements/
    __init__.py
    MainFrame.py

Inside of MainFrame.py I've defined a class named RPMWindow which extends wx.Frame.

In MainApp.py this works:

from res.elements.MainFrame import *

And this does not:

from res.elements.MainFrame import RPMWindow

I realize that the wild card import won't hurt anything, but I'm more interested in understanding why the named import is failing when the wild card succeeds.

© Stack Overflow or respective owner

Related posts about python

Related posts about import