Find DSCore sub-modules and functions

Hi All,

I’m trying to get a list of all functions from DSCore. As below, you can see bottom script does not work because its doing dir(Color) and not dir(DSCore.Color). I don’t know how to get DSCore in-front without converting to string, any help would be great. Thanks

You can use getattr to get an attribute using the string name of an attribute:

getattr(DSCore, “Color”)
If your really want to get everything (n-levels deep) you will need a recursive function.
But if you want just first level or few fixed levels deep, something like this would work

import DSCore
for module_namespace in dir(DSCore):
    mod = getattr(DSCore, module_namespace)
    for sub_module in dir(mod):
        etc.

I had gotten something started to get doc strings of all members of the ProtoGeometry module but i never finished;
if you want to take a peek at the code and at the json the code outputted:

1 Like

do you need to know the methods you can call at runtime of a dynamo graph? What are you trying to do in the end?

You can use reflection for this (write a zero touch node or use reflection from python), you can look at the xml documentation files for protogeometry and all other core libraries that ship with dynamo - or you can use python introspection code.

1 Like

Apologies for the delayed response. I wanted to understand the modules better (as attached). I will have a look at the things you’ve said. Thanks

@Gui_Talarico

Builtin_&_DSCore_Modules.xlsx (33.3 KB)

1 Like