Write Python script in VS Code

I am trying to learn python scripting with VS Code. I have questions.

  1. Why is there no “Input is Path” option in Rhino 8, then how can I “import/connect” python scripts to GH?
  2. How can I get the Rhino API/modules/IntelliSense in VS Code?
  3. Is there a better way to connect VS Code to Grasshopper?


I think I need to tell VS Code that I am trying to do Rhino code, but how?

Hold Shift and right click on the component. It’ll give you more options.

8 Likes

I got it, Thank you very much! @Mahdiyar

Hello there!

I do not know if it might help but I developed a small connector from vscode to run live python scripts both in Rhino and Grasshopper, it’s called script-sync. It is only tested on windows but it should get you run quickly to execute python script components from vscode.

You just need to install the yak package and the vscode extension of script-sync(version 1.1.0), add a script-syncpython-component, press shift-F4 in vscode and it should work fine :slight_smile:

single_comp

scriptsync_gh

8 Likes

This is amazing! this means you can edit your python code in VS Code, connect to version control like Github, use AI plugins like CoPilot, but then just “run” them in rhino/GH without worrying about your model exploding and losing all your progress!

1 Like

Exactly! Those are all the good reasons that pushed us to develop it!

1 Like