imports in __init__.py

Phil phily05 at gmail.com
Fri Dec 18 00:04:11 EST 2009


I understand all of the above, including the reasons as to why this is
bad. For purposes of experimenting, I would still like to do it.

I guess I'm (still) wondering how it is done in webpy. I recall seeing
it done elsewhere too.

All I noticed was that in webpy's package 'web', it defines the
'application' class in 'application.py'.
And in web's __init__.py it has...
    from application import *
And in whatever app you are creating, it has...
    import web
    app = web.application(params)

That being said, I can't get similar functionality with my own
package. Is there more to this? Within my package's __init__.py, I am
unable to import a module from the package without an import error.

Thanks again!



More information about the Python-list mailing list