First we create the test function we want to find.
def test(): pass
Then we will create the some_command_here function that you want.
def some_command_here(): return filter(callable, globals().values())
Finally, we call the new function and convert the filter to tuple for viewing.
tuple(some_command_here())
Note. . This searches for the current global namespace and returns all calls made (not just functions).
Example:
>>> def test(): pass >>> def some_command_here(): return filter(callable, globals().values()) >>> tuple(some_command_here()) (<function test at 0x02F78660>, <class '_frozen_importlib.BuiltinImporter'>, <function some_command_here at 0x02FAFDF8>) >>>
source share