# Write Python script in VS Code

**URL:** <https://discourse.mcneel.com/t/write-python-script-in-vs-code/172730>\
**Category:** Grasshopper\
**Tags:** windows\
**Created:** [January 5, 2024, 3:58pm UTC](https://discourse.mcneel.com/t/write-python-script-in-vs-code/172730 "2024-01-05T15:58:28Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![Quan\_Li](https://sea3.discourse-cdn.com/mcneel/user_avatar/discourse.mcneel.com/quan_li/32/679256_2.png) [@Quan\_Li](https://discourse.mcneel.com/u/Quan_Li)\
**Post date:** [January 5, 2024, 3:58pm UTC](https://discourse.mcneel.com/t/write-python-script-in-vs-code/172730/1 "2024-01-05T15:58:28Z")

</div>

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?

 ![image](https://global.discourse-cdn.com/mcneel/uploads/default/original/4X/9/d/7/9d74d144756a6e2f1fb02c0343535c4ddd115c05.png)  
I think I need to tell VS Code that I am trying to do Rhino code, but how?  
 ![image](https://global.discourse-cdn.com/mcneel/uploads/default/original/4X/9/6/6/9661027db85fe58f00b099aa069ab89c277b620f.png)

 ![image](https://global.discourse-cdn.com/mcneel/uploads/default/original/4X/3/c/3/3c3770578c49c20fb4cb113b5e3037f9c7291179.png)

---

<div class="post-metadata">

**Author:** ![Mahdiyar](https://sea3.discourse-cdn.com/mcneel/user_avatar/discourse.mcneel.com/mahdiyar/32/472862_2.png) [@Mahdiyar](https://discourse.mcneel.com/u/Mahdiyar)\
**Post date:** [January 5, 2024, 5:50pm UTC](https://discourse.mcneel.com/t/write-python-script-in-vs-code/172730/2 "2024-01-05T17:50:50Z")

</div>

> [@Quan\_Li](#):
>
> Why is there no “Input is Path” option in Rhino 8, then how can I “import/connect” python scripts to GH?

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

 ![image](https://global.discourse-cdn.com/mcneel/uploads/default/original/4X/8/7/6/8768a30f396a1ac9ede0b7443fb2cada16b6664b.png)

> [@Rhino 8 How to use input code in Grasshopper script component](https://discourse.mcneel.com/t/rhino-8-how-to-use-input-code-in-grasshopper-script-component/169547/3):
>
> According to the error text, it is necessary to set the override language on the parameter You can also set it to automatic and then add the following line at the beginning of your code: //#! csharp #! python

> [@Quan\_Li](#):
>
> How can I get the Rhino API/modules/IntelliSense in VS Code?

> **[GitHub - mcneel/pythonstubs: Python stubs for .NET assemblies](https://github.com/mcneel/pythonstubs)**
>
> Python stubs for .NET assemblies

---

<div class="post-metadata">

**Author:** ![Quan\_Li](https://sea3.discourse-cdn.com/mcneel/user_avatar/discourse.mcneel.com/quan_li/32/679256_2.png) [@Quan\_Li](https://discourse.mcneel.com/u/Quan_Li)\
**Post date:** [January 6, 2024, 10:46am UTC](https://discourse.mcneel.com/t/write-python-script-in-vs-code/172730/3 "2024-01-06T10:46:14Z")

</div>

I got it, Thank you very much! @Mahdiyar

---

<div class="post-metadata">

**Author:** ![andrea.settimi](https://sea3.discourse-cdn.com/mcneel/user_avatar/discourse.mcneel.com/andrea.settimi/32/691314_2.png) [@andrea.settimi](https://discourse.mcneel.com/u/andrea.settimi)\
**Post date:** [February 11, 2024, 7:00pm UTC](https://discourse.mcneel.com/t/write-python-script-in-vs-code/172730/4 "2024-02-11T19:00:33Z")

</div>

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](https://github.com/ibois-epfl/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 🙂

![single_comp](https://global.discourse-cdn.com/mcneel/uploads/default/original/4X/3/8/9/389f3b1d574a1588e45c4c23f9af3a99256dfae2.png)

![scriptsync_gh](https://global.discourse-cdn.com/mcneel/uploads/default/original/4X/9/a/c/9aca514cd69b9a7da9ece5e62cd24324d1dd91d7.gif)

---

<div class="post-metadata">

**Author:** ![Tushar\_Nagananda](https://sea3.discourse-cdn.com/mcneel/user_avatar/discourse.mcneel.com/tushar_nagananda/32/516733_2.png) [@Tushar\_Nagananda](https://discourse.mcneel.com/u/Tushar_Nagananda)\
**Post date:** [May 30, 2024, 11:47pm UTC](https://discourse.mcneel.com/t/write-python-script-in-vs-code/172730/5 "2024-05-30T23:47:36Z")

</div>

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!

---

<div class="post-metadata">

**Author:** ![andrea.settimi](https://sea3.discourse-cdn.com/mcneel/user_avatar/discourse.mcneel.com/andrea.settimi/32/691314_2.png) [@andrea.settimi](https://discourse.mcneel.com/u/andrea.settimi)\
**Post date:** [May 31, 2024, 7:23am UTC](https://discourse.mcneel.com/t/write-python-script-in-vs-code/172730/7 "2024-05-31T07:23:51Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![Jonas\_Feron](https://sea3.discourse-cdn.com/mcneel/user_avatar/discourse.mcneel.com/jonas_feron/32/647905_2.png) [@Jonas\_Feron](https://discourse.mcneel.com/u/Jonas_Feron)\
**Post date:** [February 8, 2025, 3:22pm UTC](https://discourse.mcneel.com/t/write-python-script-in-vs-code/172730/9 "2025-02-08T15:22:29Z")

</div>

For those interested in developing a **full Grasshopper plugin** with multiple Python components in **Visual Studio** , similar to [the official Grasshopper C# template](https://developer.rhino3d.com/guides/grasshopper/your-first-component-windows/), this related **[discussion on the McNeel Forum](https://discourse.mcneel.com/t/connecting-grasshopper-and-visual-studio-or-visual-studio-code-for-python/111021)** may also be of interest.
