# Combine python script and dynamo script

**URL:** <https://forum.dynamobim.com/t/combine-python-script-and-dynamo-script/77458>\
**Category:** Revit\
**Tags:** python, dynamo\
**Created:** [June 9, 2022, 6:57am UTC](https://forum.dynamobim.com/t/combine-python-script-and-dynamo-script/77458 "2022-06-09T06:57:40Z")\
**Posts on this page:** 10\
**Page:** 1

<div class="post-metadata">

**Author:** ![technitutors](https://avatars.discourse-cdn.com/v4/letter/t/45deac/32.png) [@technitutors](https://forum.dynamobim.com/u/technitutors)\
**Post date:** [June 9, 2022, 6:57am UTC](https://forum.dynamobim.com/t/combine-python-script-and-dynamo-script/77458/1 "2022-06-09T06:57:40Z")

</div>

Hi All

Is there a way to combine the two below, so that the python runs after the complex dynamo script?

 ![image](https://us1.discourse-cdn.com/flex022/uploads/dynamobim/original/3X/f/c/fc02cc342e0932d6e511bbdf56a70292e9b40eb0.png)  
 ![image](https://us1.discourse-cdn.com/flex022/uploads/dynamobim/original/3X/8/7/87f676a9f2bb596252bc2a8115d63adab6aa5a3f.png)

---

<div class="post-metadata">

**Author:** ![Rookio](https://avatars.discourse-cdn.com/v4/letter/r/9fc29f/32.png) [@Rookio](https://forum.dynamobim.com/u/Rookio)\
**Post date:** [June 9, 2022, 7:02am UTC](https://forum.dynamobim.com/t/combine-python-script-and-dynamo-script/77458/2 "2022-06-09T07:02:39Z")

</div>

There are a couple of ways to accomplish this. You can incorporate a passthrough or wait node between the rest of your graph and the Python script. Depends on the nodes you are using, some work well with passthrough (clockwork) and some not so well. You can modify your python code to look for a bool true before running, and have your existing graph provide the true input after it completes. Search the forum for “Python wait for” or something similar and you should get multiple results

---

<div class="post-metadata">

**Author:** ![technitutors](https://avatars.discourse-cdn.com/v4/letter/t/45deac/32.png) [@technitutors](https://forum.dynamobim.com/u/technitutors)\
**Post date:** [June 9, 2022, 7:27am UTC](https://forum.dynamobim.com/t/combine-python-script-and-dynamo-script/77458/3 "2022-06-09T07:27:11Z")

</div>

problem is I have no idea where to place the python script or where to connect it to in the first script. node. If I connect it to the end of the complex script would it run after? Its a matter of knowing how to connect it and IM not sure how to do this

---

<div class="post-metadata">

**Author:** ![Rookio](https://avatars.discourse-cdn.com/v4/letter/r/9fc29f/32.png) [@Rookio](https://forum.dynamobim.com/u/Rookio)\
**Post date:** [June 9, 2022, 7:38am UTC](https://forum.dynamobim.com/t/combine-python-script-and-dynamo-script/77458/4 "2022-06-09T07:38:59Z")

</div>

Try something similar to this  
Then adapt it to your Python script

 ![Capture](https://us1.discourse-cdn.com/flex022/uploads/dynamobim/original/3X/3/8/389c2f305e65a7e0945941991a5fa5935ecf5de8.png)

---

<div class="post-metadata">

**Author:** ![technitutors](https://avatars.discourse-cdn.com/v4/letter/t/45deac/32.png) [@technitutors](https://forum.dynamobim.com/u/technitutors)\
**Post date:** [June 9, 2022, 9:28am UTC](https://forum.dynamobim.com/t/combine-python-script-and-dynamo-script/77458/5 "2022-06-09T09:28:59Z")

</div>

[EXPORTMULTIPLESCHEDULES.dyn](https://forum.dynamobim.com/uploads/short-url/shRRB7vNLVDhWsEeJsL1f2EZwMk.dyn) (55.5 KB)  
[test.dyn](https://forum.dynamobim.com/uploads/short-url/67luA6ePNI0VQI73hId0TwnkdKh.dyn) (3.1 KB)  
these are the files I need to combine. Im working with schedules not parameters

---

<div class="post-metadata">

**Author:** ![ruben.romero](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.dynamobim.com/ruben.romero/32/115842_2.png) [@ruben.romero](https://forum.dynamobim.com/u/ruben.romero)\
**Post date:** [June 9, 2022, 10:17am UTC](https://forum.dynamobim.com/t/combine-python-script-and-dynamo-script/77458/6 "2022-06-09T10:17:31Z")

</div>

> [@technitutors](#):
>
> so that the python runs after the complex dynamo script?

write a code block like this for example to do the same than the Passthrough package node:

`[pass,wait][0];`

pass: the data wanted to feed in python IN[0]  
wait: the output of any other node or process in the script, so until this output is not finished, the python node does not get the input and start to run.

You can put this inside the python node as well and add a second input to wait for

---

<div class="post-metadata">

**Author:** ![technitutors](https://avatars.discourse-cdn.com/v4/letter/t/45deac/32.png) [@technitutors](https://forum.dynamobim.com/u/technitutors)\
**Post date:** [June 9, 2022, 10:30am UTC](https://forum.dynamobim.com/t/combine-python-script-and-dynamo-script/77458/7 "2022-06-09T10:30:32Z")

</div>

> [@ruben.romero](#):
>
> [pass,wait][0];

i think my issue is I dont know where to plug this information in so it can work. Im trying this but its not running

 ![image](https://us1.discourse-cdn.com/flex022/uploads/dynamobim/original/3X/5/4/542abbe680630fd2a07f6173db05856a2d587dc7.png)

---

<div class="post-metadata">

**Author:** ![ruben.romero](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.dynamobim.com/ruben.romero/32/115842_2.png) [@ruben.romero](https://forum.dynamobim.com/u/ruben.romero)\
**Post date:** [June 9, 2022, 11:04am UTC](https://forum.dynamobim.com/t/combine-python-script-and-dynamo-script/77458/8 "2022-06-09T11:04:00Z")

</div>

> [@technitutors](#):
>
> i think my issue is I dont know where to plug this information in so it can work. Im trying this but its not running

so please share an image here that can be read properly, you can use the button symbol of screenshot of Dynamo

 ![image](https://us1.discourse-cdn.com/flex022/uploads/dynamobim/original/3X/2/3/23a8fa36c0921dc97f41c0a6a2addcb8ab455480.png)

you got that passthrough function already in the script, the package node can be replaced by the code I proposed:

 ![image](https://us1.discourse-cdn.com/flex022/uploads/dynamobim/original/3X/6/f/6f2b4a3da1e5c39bb672ed89396c4bfc91fb2e9c.png)

---

<div class="post-metadata">

**Author:** ![Daan](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.dynamobim.com/daan/32/82246_2.png) [@Daan](https://forum.dynamobim.com/u/Daan)\
**Post date:** [June 9, 2022, 11:08am UTC](https://forum.dynamobim.com/t/combine-python-script-and-dynamo-script/77458/9 "2022-06-09T11:08:10Z")

</div>

You’ll have to place the Python script after the PassThrough node, like this:

 ![image](https://us1.discourse-cdn.com/flex022/uploads/dynamobim/original/3X/c/d/cd1f03d1581b724160eecf315a9def8438981d67.jpeg)

Also, if you have multiple outputs on where you want the script to (force) execute them first, use something like this:

 ![image](https://us1.discourse-cdn.com/flex022/uploads/dynamobim/original/3X/b/4/b4d39b82af29aec26aa5af18146fbb3ee160afce.jpeg)  
PS: If you have no specific inputs you can just put in whatever you want as input for the Python node. If you have some inputs, just feed them through where the string is now.

---

<div class="post-metadata">

**Author:** ![technitutors](https://avatars.discourse-cdn.com/v4/letter/t/45deac/32.png) [@technitutors](https://forum.dynamobim.com/u/technitutors)\
**Post date:** [June 9, 2022, 11:57am UTC](https://forum.dynamobim.com/t/combine-python-script-and-dynamo-script/77458/10 "2022-06-09T11:57:47Z")

</div>

thanks all! they are actually both a solution so now I can finally finish off this project
