How to get self reference from within a module?

Gabriel Genellina gagsl-py at
Mon Jan 22 20:15:00 EST 2007

At Monday 22/1/2007 20:26, Lavoie Érick wrote:

>  i would like to now how to get a self 
> reference from within a module.  The goal is to 
> be able to generate a list of all declared function within the module.

 From inside the module, use globals() - that 
includes all defined symbols (classes, imported 
modules, functions, etc). You can filter them 
using inspect.isfunction by example.

Gabriel Genellina
Softlab SRL 


Preguntá. Respondé. Descubrí. 
Todo lo que querías saber, y lo que ni imaginabas, 
está en Yahoo! Respuestas (Beta). 
¡Probalo ya! 

More information about the Python-list mailing list