imports in __init__.py

lotrpy lotrpy at gmail.com
Sat Dec 26 22:23:50 EST 2009


On Dec 18, 12:34 pm, Ben Finney <ben+pyt... at benfinney.id.au> wrote:
> Phil <phil... at gmail.com> writes:
> > From an arbitrary python module, I 'import packagename'.
>
> At that point, you have all the names that were defined within
> ‘packagename’, available inside the namespace ‘packagename’. Since
> ‘modulename’ is a module in that package, the module's namespace is
> available to you via ‘packagename.modulename’.
it looks that one need put the "import modulename" line in __init__.py
or "import packagename.modulename" in the user clent script
explicitly. or else, just 'import packagename' is not enough to use
packagename.modulename.



More information about the Python-list mailing list