Organizing code - import question

Carlos Hanson carlos.hanson at gmail.com
Fri May 4 09:40:22 EDT 2007


On 5/3/07, Brian Blais <bblais at bryant.edu> wrote:
> Carlos Hanson wrote:
> > It looks like you need __init__.py in MyPackage.  Then you can import
> > starting with MyPackage.  For example, you might use one of the
> > following:
> >
> >   import MyPackage
> >   from MyPackage.Common import *
> >   etc
> >
>
> that means that MyPackage must be in the sys path too?  It doesn't seem like a
> contained-module sees the container in any way.
>

That is exactly right.  Without being in the sys path, Python does not
know where to look to resolve the import statements.


-- 
Carlos Hanson



More information about the Python-list mailing list