you can use dir to explore a namespace.
import foo
print dir(foo)
Example: loading your foo in shell
>>> import foo
>>> dir(foo)
['__builtins__', '__doc__', '__file__', '__name__', '__package__', 'foo1', 'foo2', 'foo3']
>>>
>>> getattr(foo, 'foo1')
<function foo1 at 0x100430410>
>>> k = getattr(foo, 'foo1')
>>> k.__name__
'foo1'
>>> callable(k)
True
>>>
You can use getattr to get the associated attribute in foo and find out if it callable.
Check the documentation : http://docs.python.org/tutorial/modules.html#the-dir-function
and if you do - "from foo import *" then the names are included in the namespace where you call this.
>>> from foo import *
>>> dir()
['__builtins__', '__doc__', '__name__', '__package__', 'atexit', 'foo1', 'foo2', 'foo3']
>>>
The following brief on introspection in python might help you :
- http://www.ibm.com/developerworks/library/l-pyint.html