Reputation: 118792
If you want to see what modules are defined in a particular module while in the Python shell, one option is to type dir(path.to.module)
. Unfortunately, this doesn't just list the classes or functions defined in a particular module, it also included classes or functions that the module imports
Upvotes: 1
Views: 54
Reputation: 118792
The following function will only return functions and classes defined in a particular module
def getDefined(module):
print([x for x in dir(module) if
getattr(module.__dict__[x], '__module__','')==module.__name__
])
Upvotes: 1