Connecting Grasshopper and Visual Studio or Visual Studio Code for Python


I am thinking about writing the Grasshopper Python codes in Visual Studio or Visual Studio Code. Is there a way to do that?

I know you can have a connection between Rhino and Visual Studio Code but not with the Grasshopper Python per my knowledge. Please let me know if there is anyone who can shed some light on it. Would appreciate that. Thanks!


As far as I know, there is no good solution for this right now. What I sometimes do is reading code saved in external files using the “code” input of ghpython components. You don’t have any code completion then, but can use version controls systems and use editor features like code formatting then.

So you could develop in the gh component and then move to an external .py file.

1 Like

Thank you for the relpy Martin. Let me try what you have just said but I am pretty I will struggle to figure that out as I never had the chance to explore this part. Hopefully will come across some other methods as well.


You could also write your scripts as a module and place it in

%APPDATA%\McNeel\Rhinoceros\6.0\Plug-ins\IronPython (814d908a-e25c-493d-97e9-ee3861957f49)\settings\lib

You can then import your module inside your ghPython script component and use it by just setting up some interfacing functions you prepare to feed in GH inputs etc. If you make changes to your module code and want to update / hotswap it once it has been loaded in your current Rhino session, you can use built in module reload function.

reload(<your module>)

You can also get autocompletion for RhinoCommon/Grasshopper in external Python editors:

1 Like