Directory or library of functions in imported module


#1

Hi, I’m quite new to programming and dynamo, but i’m trying to create some python scripts to import in my dynamo scripts.
But here is my question; Is it possible to review a list of callable functions within the modules I am importing?

For example: I am importing the modules as shown on the screenshot, but i’m not sure wich function i’ll be able to call within these methods. Does anyone know if there is list of callebles so I can review them and develop more knowledge of the module?

Thanks


#2

You could do something like the code below.
If you are trying to understand the modules, you can also benefit from peeking through the source code on dynamo and dynamo revit repos (https://github.com/DynamoDS/Dynamo/tree/master/src)

is_callable = []
docstrings = []
for attr_name in dir(DocumentManager):
    attr = getattr(DocumentManager, attr_name)
    if hasattr(attr, "__call__"):  # True is callable
        is_callable.append(attr)
        docstrings.append(attr.__doc__)

# output and inspect is_callable and docstrings 

(did not run code, might have errors or typos! :))