# Dyno - Automatically trigger a script to run

**URL:** <https://forum.dynamobim.com/t/dyno-automatically-trigger-a-script-to-run/55888>\
**Category:** Uncategorized\
**Created:** [October 6, 2020, 9:33am UTC](https://forum.dynamobim.com/t/dyno-automatically-trigger-a-script-to-run/55888 "2020-10-06T09:33:29Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![paulstevens90](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.dynamobim.com/paulstevens90/32/100222_2.png) [@paulstevens90](https://forum.dynamobim.com/u/paulstevens90)\
**Post date:** [October 6, 2020, 9:33am UTC](https://forum.dynamobim.com/t/dyno-automatically-trigger-a-script-to-run/55888/1 "2020-10-06T09:33:29Z")

</div>

Hi All,

Does anyone know if its possible for Dyno to trigger a script once an action happens?  
For example if someone clicks sync, dyno automatically runs a script?

I notice Dyno seems to open the dynamo core on startup so presumably something is running in the background.

I know its possible if i were to create my own ‘real’ add-in, but wonder if theres an alternative?

---

<div class="post-metadata">

**Author:** ![paulstevens90](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.dynamobim.com/paulstevens90/32/100222_2.png) [@paulstevens90](https://forum.dynamobim.com/u/paulstevens90)\
**Post date:** [November 8, 2021, 10:48am UTC](https://forum.dynamobim.com/t/dyno-automatically-trigger-a-script-to-run/55888/2 "2021-11-08T10:48:13Z")

</div>

A year later, but just seeing if anyone knows if this is possible or not?

Currently I’m using @john_pierson’s [Relay](https://www.notion.so/Relay-for-Revit-6732550b41d34bce8edc518c0d0e47b9) to run scripts from buttons, which is great.  
And I believe that python scripts can be run using hooks in PyRevit, but whether its possible to trigger a .dyn when someone syncs (for example) is the part I’m unsure about.

Does anyone know if this is possible?

Thanks in advance  
Paul

---

<div class="post-metadata">

**Author:** ![GavinNicholls](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.dynamobim.com/gavinnicholls/32/190442_2.png) [@GavinNicholls](https://forum.dynamobim.com/u/GavinNicholls)\
**Post date:** [November 9, 2021, 9:54am UTC](https://forum.dynamobim.com/t/dyno-automatically-trigger-a-script-to-run/55888/3 "2021-11-09T09:54:48Z")

</div>

I haven’t had any luck with this using pyRevit, only hooks written as pythom scripts. I expect if you programmed an addin to run dynamo in the background it may be possible, but havent seen one that does this to date (only run when button clicked).

---

<div class="post-metadata">

**Author:** ![Daniel\_Woodcock1](https://avatars.discourse-cdn.com/v4/letter/d/58f4c7/32.png) [@Daniel\_Woodcock1](https://forum.dynamobim.com/u/Daniel_Woodcock1)\
**Post date:** [November 9, 2021, 10:45am UTC](https://forum.dynamobim.com/t/dyno-automatically-trigger-a-script-to-run/55888/4 "2021-11-09T10:45:57Z")

</div>

Sure, as an addin you can listen to events and execute code on these events. Not sure how you’d do it with dyno though as I’m guessing there is no builtin option to hook the dyn file execution on these events… Maybe a feature which could be added to Dyno or Relay by giving user ability to bind scripts to events. @john_pierson?

---

<div class="post-metadata">

**Author:** ![paulstevens90](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.dynamobim.com/paulstevens90/32/100222_2.png) [@paulstevens90](https://forum.dynamobim.com/u/paulstevens90)\
**Post date:** [November 9, 2021, 12:24pm UTC](https://forum.dynamobim.com/t/dyno-automatically-trigger-a-script-to-run/55888/5 "2021-11-09T12:24:10Z")

</div>

Thanks @Daniel_Woodcock1 and @GavinNicholls.  
Sorry for the confusion - I was playing around with Dyno when i created the topic originally, but using Relay at the moment due to its simplicity.  
Good to know it’s possible!

---

<div class="post-metadata">

**Author:** ![john\_pierson](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.dynamobim.com/john_pierson/32/191977_2.png) [@john\_pierson](https://forum.dynamobim.com/u/john_pierson)\
**Post date:** [November 9, 2021, 6:09pm UTC](https://forum.dynamobim.com/t/dyno-automatically-trigger-a-script-to-run/55888/6 "2021-11-09T18:09:24Z")

</div>

This is definitely something I have messed with in the past. (Even before Relay) I would love to have hooks for DYNs.

Initially, I had a text parameter on family instances that pointed at a DYN path. And anything the family was modified the DYN ran (slowly) but it ran.

If someone wants to toss it on the Relay github issues as a feature request, we can see what we can do when time allows. 😁

---

<div class="post-metadata">

**Author:** ![paulstevens90](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.dynamobim.com/paulstevens90/32/100222_2.png) [@paulstevens90](https://forum.dynamobim.com/u/paulstevens90)\
**Post date:** [November 10, 2021, 9:03am UTC](https://forum.dynamobim.com/t/dyno-automatically-trigger-a-script-to-run/55888/7 "2021-11-10T09:03:12Z")

</div>

Very cool John, sounds brilliant, added to the github issues as a feature request:

[https://github.com/johnpierson/Relay/issues/9](https://github.com/johnpierson/Relay/issues/9)

Thankyou @john_pierson
