imports in __init__.py
Phil
phily05 at gmail.com
Thu Dec 17 22:37:22 EST 2009
I use distutils / setup.py to install 'packagename', where...
/packagename
__init__.py
modulename.py
modulename.py has a class named 'classname'.
>From an arbitrary python module, I 'import packagename'.
In said module, I want to use the 'classname' class from
'packagename.modulename', by doing 'packagename.classname(params)'.
I have seen this done by having either 'import modulename' and/or
'from modulename import *' in 'packagename's __init__.py. I don't
really know which one or combination of them would work, but I can't
get it to work either way. Unless I am missing something, webpy does
this with, among other things, its application class that is in
application.py. From a new web app, you would just use web.application
(params).
I am using Python 3.1.1, although I don't think that should matter.
Any help is appreciated. Thanks!
More information about the Python-list
mailing list