[Tutor] still clarifying imorting

Dave Angel davea at davea.name
Tue May 21 04:05:18 CEST 2013


On 05/20/2013 09:43 PM, Jim Mooney wrote:
> If I make a package called jimlib with __init__.py in it, and a
> program called bark.py in it, and even put it in site packages, I
> still have to import the program with   import jimlib.bark
>
> But I noticed that the pygraphics package is in site packages, and has
> media.py in it, and all I have to do with that is import media,
> without qualifying it with pygraphics, as in import pygraphics.media
>
> Why don't I have to drill down for media.py as I do with jimlib?
>

I'd guess that pygraphics has some content in their __init__.py.  That 
content gets executed when you import it.

-- 
DaveA


More information about the Tutor mailing list