Current module reference
Steve Holden
steve at holdenweb.com
Wed Aug 16 09:08:37 EDT 2006
Miguel Galves wrote:
> Hi
>
> How do I get a reference for the current module I'm in ?
> I have a package called services with a __init__.py
> that need to use getattr() to fill out a hash whith
> my package attributes. But to use getattr, I need
> a object that references my package (kind of this this reference in Java).
> How can I do it ?
>
> the only way I found to o this is to call get attr from another
> module that imports the services package. But I suppose
> it's not the only way....
>
sys.modules[__name__] ?
regards
Steve
--
Steve Holden +44 150 684 7255 +1 800 494 3119
Holden Web LLC/Ltd http://www.holdenweb.com
Skype: holdenweb http://holdenweb.blogspot.com
Recent Ramblings http://del.icio.us/steve.holden
More information about the Python-list
mailing list