[Tutor] Name of a module within itself

alan.gauld@bt.com alan.gauld@bt.com
Sun, 22 Jul 2001 20:51:37 +0100


>   refer to the name of the module (foo), such that, I could 
> do something like:
> 
> def main():
> 	....
> 	getattr([refer to this module], 'HisFoo')
> 	
>   how do I do that ?

getattr(foo,'HisFoo')

works for me, what do you get?

> >>> import foo
> >>> getattr(foo, 'HisFoo')
> <class foo.HisFoo at 0x810fde4>

Yes thats what I get from a script too.

Alan g