# Pass arguments to python script called from C# plugin

**URL:** <https://discourse.mcneel.com/t/pass-arguments-to-python-script-called-from-c-plugin/15512>\
**Category:** Rhino Developer\
**Created:** [January 9, 2015, 10:56am UTC](https://discourse.mcneel.com/t/pass-arguments-to-python-script-called-from-c-plugin/15512 "2015-01-09T10:56:04Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![filip\_rooms](https://sea3.discourse-cdn.com/mcneel/user_avatar/discourse.mcneel.com/filip_rooms/32/6370_2.png) [@filip\_rooms](https://discourse.mcneel.com/u/filip_rooms)\
**Post date:** [January 9, 2015, 10:56am UTC](https://discourse.mcneel.com/t/pass-arguments-to-python-script-called-from-c-plugin/15512/1 "2015-01-09T10:56:04Z")

</div>

Dear community,

To load and run PYTHON scripts from C#.  
I already found the RunPythonScript command, and was able to run a standalone script with filename “externalscript” from C# like:

```
        if (!Rhino.RhinoApp.RunScript("-RunPythonScript " + externalScript, echoScriptCommand))
        {
           MessageBox.Show("ERROR: Loadscript FAILED!", "ModelSeatPanel", MessageBoxButtons.OK, MessageBoxIcon.Asterisk);
        }

```

My questions:

1. how can I pass arguments to this script (coming from my C# environment)?
2. what is still in the engine/interpreter after running a script? Is it possible e.g. when clicking a button to run a function from a script, have the results like in global variables or somewhere else and then click another button to run another script that uses these variables?

Kind regards,

Filip

---

<div class="post-metadata">

**Author:** ![Lim\_Kiteak](https://avatars.discourse-cdn.com/v4/letter/l/c68b51/32.png) [@Lim\_Kiteak](https://discourse.mcneel.com/u/Lim_Kiteak)\
**Post date:** [December 23, 2015, 3:11am UTC](https://discourse.mcneel.com/t/pass-arguments-to-python-script-called-from-c-plugin/15512/3 "2015-12-23T03:11:46Z")

</div>

On C#, just add your parameters after python script filename.

```
string macro = string.Format("_-RunPythonScript \"{0}\" \"{1}\" ", pyScript, dxf);
rhino.RunScript(macro, 1);

```

On Python, just rs.GetString(). It depends on parameter data type.

```
def myMain():
    myoptions = ["DXF"]
    FilePath = rs.GetString("Get DXF File", "DXF", myoptions)
```
