How to get entire code inside Python Script

You can parse the Dynamo file which is an XML file before Dynamo 2.0 and a JSON file for Dynamo 2.0 and after that. The python code is included inside the file. If you know the path to the Dynamo file then all you need is a parser.

Also you might be interested in dyfpy library which I wrote to convert Grasshopper GHPython components to Dynamo custom nodes. You can use them to create a Dynamo custom node from a JSON file which includes inputs, outputs and the code.

4 Likes