I am currently working with Python script components in Grasshopper and have encountered a challenge that I believe others might also be facing. As part of my project documentation and possible sharing code as Jupyter Notebook, I want to export the Python scripts embedded within the Script and/or Python3 components en masse, rather than manually copying out each script one by one, and do so after each change. A manual process is time-consuming, especially when dealing with large definitions that contain multiple script components.
From my understanding and attempts (but i am no python expert), there doesn’t seem to be a straightforward method to programmatically access the Python script content directly from these components
What I’m looking for:
- A way to programmatically extract all Python scripts from my Grasshopper document, ideally through a batch process.
- Alternatively add a string output to each node that take it’s content. And then I append it from the panels and save it from there (hopefully ;)0
Thank you all for your help and time!
get_python_nodes_content.gh (8.4 KB)
Here is waht I have thus far, check by type and get guid