Use inspect.getmembers
to get all the variables/classes/functions etc. in a module, and pass in inspect.isfunction
as the predicate to get just the functions:
from inspect import getmembers, isfunction
from my_project import my_module
functions_list = [o for o in getmembers(my_module) if isfunction(o[1])]
getmembers
returns a list of (object_name, object)
tuples sorted alphabetically by name.
You can replace isfunction
with any of the other isXXX
functions in the inspect
module.