# Functionality of Project Update scripts -- needed for each project?

**URL:** <https://forum.inductiveautomation.com/t/functionality-of-project-update-scripts-needed-for-each-project/91647>\
**Category:** Ignition\
**Tags:** scripting, ignition81\
**Created:** [June 10, 2024, 6:55pm UTC](https://forum.inductiveautomation.com/t/functionality-of-project-update-scripts-needed-for-each-project/91647 "2024-06-10T18:55:38Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![Bushmatic](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/bushmatic/32/87014_2.png) [@Bushmatic](https://forum.inductiveautomation.com/u/Bushmatic)\
**Post date:** [June 10, 2024, 6:55pm UTC](https://forum.inductiveautomation.com/t/functionality-of-project-update-scripts-needed-for-each-project/91647/1 "2024-06-10T18:55:38Z")

</div>

If I were to write a Project Update script in order to save details about any project any time it is saved in a Designer session, would this script have to be added to **each project** , or just **one** project? I'm exploring the idea of using this type of script for some semblance of version control.

Side note, I added a suggestion [here](https://inductiveautomation.canny.io/ignition-features-and-ideas/p/add-ability-to-save-ignition-projects-to-a-specified-location-within-gateway-upd) to allow us to export project .zip files through scripting -- it would be awesome if the gateway were able to take an export of a project any time it gets saved.

 ![image](https://us1.discourse-cdn.com/inductiveautomation/original/3X/c/d/cd7531ef3f6e08f7f20ecc6f346fb09f522eaeb4.jpeg)

> **[Gateway Event Scripts | Ignition User Manual](https://docs.inductiveautomation.com/docs/8.1/platform/scripting/scripting-in-ignition/gateway-event-scripts)**
>
> Gateway Event Scripts Overview

---

<div class="post-metadata">

**Author:** ![pascal.fragnoud](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/pascal.fragnoud/32/24728_2.png) [@pascal.fragnoud](https://forum.inductiveautomation.com/u/pascal.fragnoud)\
**Post date:** [June 10, 2024, 7:08pm UTC](https://forum.inductiveautomation.com/t/functionality-of-project-update-scripts-needed-for-each-project/91647/2 "2024-06-10T19:08:04Z")

</div>

Only the project it's defined in.  
And before you ask the inevitable follow up question: I believe you should NOT put gateway events in an inheritable project... BUT, you can put the script in an inheritable project's library, and call it from the gateway events in the projects that need it.

---

<div class="post-metadata">

**Author:** ![Bushmatic](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/bushmatic/32/87014_2.png) [@Bushmatic](https://forum.inductiveautomation.com/u/Bushmatic)\
**Post date:** [June 10, 2024, 7:13pm UTC](https://forum.inductiveautomation.com/t/functionality-of-project-update-scripts-needed-for-each-project/91647/3 "2024-06-10T19:13:46Z")

</div>

> [@pascal.fragnoud](#):
>
> I believe you should NOT put gateway events in an inheritable project...

Why is this?

---

<div class="post-metadata">

**Author:** ![pascal.fragnoud](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/pascal.fragnoud/32/24728_2.png) [@pascal.fragnoud](https://forum.inductiveautomation.com/u/pascal.fragnoud)\
**Post date:** [June 10, 2024, 7:16pm UTC](https://forum.inductiveautomation.com/t/functionality-of-project-update-scripts-needed-for-each-project/91647/4 "2024-06-10T19:16:00Z")

</div>

I seem to recall that the event would trigger twice.  
I'm really not sure about this, but for some reason it's somewhere in my brain.  
The good news is, you can easily test that. I'd do it myself, but I don't have ignition on this machine.

---

<div class="post-metadata">

**Author:** ![lrose](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/lrose/32/62724_2.png) [@lrose](https://forum.inductiveautomation.com/u/lrose)\
**Post date:** [June 10, 2024, 7:21pm UTC](https://forum.inductiveautomation.com/t/functionality-of-project-update-scripts-needed-for-each-project/91647/5 "2024-06-10T19:21:41Z")

</div>

See this post:

> [@Advice on creating a base project to be used across a large number of plants with limited variation](https://forum.inductiveautomation.com/t/advice-on-creating-a-base-project-to-be-used-across-a-large-number-of-plants-with-limited-variation/41313/6):
>
> I can't speak to what will work best for you/your environment, but some general technical concerns to be aware of: As you are aware, inheritable projects will not run scripts. Inherited projects will, but there's another wrinkle there - all gateway event scripts (startup, shutdown, timer, message handler) are one resource. As soon as any change is made in the leaf projects, you're no longer inheriting from the parent, and there's no obvious way to revert. In the short term, we want to make tha…

There are others around the forum, but this was the first that I found.

---

<div class="post-metadata">

**Author:** ![Ryan\_Deardorff](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/ryan_deardorff/32/63815_2.png) [@Ryan\_Deardorff](https://forum.inductiveautomation.com/u/Ryan_Deardorff)\
**Post date:** [June 10, 2024, 7:38pm UTC](https://forum.inductiveautomation.com/t/functionality-of-project-update-scripts-needed-for-each-project/91647/6 "2024-06-10T19:38:41Z")

</div>

Gateway events in an inheritable project will only get triggered from whatever project(s) inherit them, but that means _they will get triggered multiple times_ if more than one project inherits them.

---

<div class="post-metadata">

**Author:** ![Bushmatic](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/bushmatic/32/87014_2.png) [@Bushmatic](https://forum.inductiveautomation.com/u/Bushmatic)\
**Post date:** [June 10, 2024, 8:04pm UTC](https://forum.inductiveautomation.com/t/functionality-of-project-update-scripts-needed-for-each-project/91647/7 "2024-06-10T20:04:39Z")

</div>

Thank you. So it sounds like the best practice is to keep gateway events as brief as possible, putting the main meat of the code into a project library script instead.

Let me make sure I have the test right in my head: I will grab the `actor` and `resources` parameters within a leaf project's Project Update gateway event script, and immediately pass those into a shared script resource (in an inheritable library) that will handle dumping that data somewhere into a shared drive. If I need to update this logic down the line (e.g. change the directory location, or file formatting, etc.), I can modify the appropriate library script and feel confident that the inheritance will work out alright.

Does this line of thinking check out?

---

<div class="post-metadata">

**Author:** ![lrose](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/lrose/32/62724_2.png) [@lrose](https://forum.inductiveautomation.com/u/lrose)\
**Post date:** [June 11, 2024, 8:57pm UTC](https://forum.inductiveautomation.com/t/functionality-of-project-update-scripts-needed-for-each-project/91647/8 "2024-06-11T20:57:32Z")

</div>

> [@Bushmatic](#):
>
> Let me make sure I have the test right in my head: I will grab the `actor` and `resources` parameters within a leaf project's Project Update gateway event script, and immediately pass those into a shared script resource (in an inheritable library) that will handle dumping that data somewhere into a shared drive. If I need to update this logic down the line (e.g. change the directory location, or file formatting, etc.), I can modify the appropriate library script and feel confident that the inheritance will work out alright.

Yes, I believe this to be correct. Just use caution, updating an inherited script will trigger scripting restarts on all inheriting projects, which may result in unexpected or undefined behavior from your scripts that may or may not be running at the time of the restart.
