# Grasshopper batch execution

**URL:** <https://discourse.mcneel.com/t/grasshopper-batch-execution/119959>\
**Category:** CPython\
**Created:** [March 8, 2021, 4:40pm UTC](https://discourse.mcneel.com/t/grasshopper-batch-execution/119959 "2021-03-08T16:40:52Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![rsimoon](https://sea3.discourse-cdn.com/mcneel/user_avatar/discourse.mcneel.com/rsimoon/32/178386_2.png) [@rsimoon](https://discourse.mcneel.com/u/rsimoon)\
**Post date:** [March 8, 2021, 4:40pm UTC](https://discourse.mcneel.com/t/grasshopper-batch-execution/119959/1 "2021-03-08T16:40:52Z")

</div>

Hi everyone,

I’m trying to automate the execution of GH files via python.

I have several CAD (~1000) files (.step)

And several GH files to make the multiple process on part. Between each process I save them as .3dm.

My first attempt was to make like in .bat file but with python using os.system(my\_cmd).

My\_cmd= « {path\_to\_rhino.exe} /nosplash /runscript=’\_GrasshopperOpen {path\_to\_gh\_file} \_enter ».

It almost worked, but I’ve got GHpython componant with rs.Command ("\_-Insert “+ **str** (path)+” \_Bloc \_Enter 0,0,0 1 \_Enter \_Enter ") in my gh doc.

It seems that this command from the GHpython componant is executing before the « \_enter » of my\_cmd. So nothing hapen in document because the initial Insert dont work.

 ![image](https://global.discourse-cdn.com/mcneel/uploads/default/original/4X/0/f/7/0f75493df9d2775003778dbbbff7b81465fd3f05.png)

My second attempt was to use RhinoInside from python.

I think this solution is better, because I can run headless , save time and maybe I can manage to make the CAD treatment 1 by 1 which will be safer.

But I missed some documentation about how to use it.

First, this error occur each time I execute.  
 ![image](https://global.discourse-cdn.com/mcneel/uploads/default/original/4X/4/d/7/4d7bcde9734db0058b25bc309c42d124ffa9d40e.png)

Then, when I close this alert, my python script seems to work, but it does absolutely nothing. It is supose to save files as .3dm but i doesn’t.

Any help is welcome

[file1.gh](https://discourse.mcneel.com/uploads/short-url/yKgvGj3SirBRynzEqZzad0v1W0z.gh) (20.2 KB) [inside.py](https://discourse.mcneel.com/uploads/short-url/3y11xe5tFy1y7PHnyyp3Q3lNaM9.py) (1.0 KB)
