relative import broken?
__peter__ at web.de
Wed Apr 30 16:12:17 CEST 2008
> basic noob question here.
> i am trying to reference a package, i have the structure:
> can someone please tell me why the statement:
> from mypack.subdir1.mod1 import *
> does NOT work from mod2.py nor from test.py?
> instead, if i use:
> from subdir1.mod1 import *
> it works perfectly from test.py.
The parent directory of mypack must be in the module search path, see
The least intrusive way to achieve this is to move test.py one level up in
the directory hierarchy.
More information about the Python-list