# Gateway Scripts best practice

**URL:** <https://forum.inductiveautomation.com/t/gateway-scripts-best-practice/109017>\
**Category:** Ignition\
**Tags:** vision\
**Created:** [July 28, 2025, 6:24pm UTC](https://forum.inductiveautomation.com/t/gateway-scripts-best-practice/109017 "2025-07-28T18:24:35Z")\
**Posts on this page:** 1\
**Showing post:** 2

<div class="post-metadata">

**Author:** ![pturmel](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/pturmel/32/3295_2.png) [@pturmel](https://forum.inductiveautomation.com/u/pturmel)\
**Post date:** [July 28, 2025, 6:55pm UTC](https://forum.inductiveautomation.com/t/gateway-scripts-best-practice/109017/2 "2025-07-28T18:55:26Z")

</div>

All projects exist in the gateway. All leaf projects (that is, non-inheritable) can have project-specific gateway event scripts: startup, timer, tag change, message handler, shutdown, and scheduled. (Non-inheritable projects can also have them, but they won't run there, just where inherited--that way lies madness.)

Certain gateway objects, particularly **tags** , do not belong to any project, and do not naturally have access to library scripts. A single project, not necessarily a leaf project, can be specified as the "Gateway Scripting Project", making its scripts accessible from tag events (attached to the tag) and/or expression tags using `runScript()`.

Consider using project inheritance to organize your project library:

> [@Where do/should Gateway Scripts live with respect to an inherited project structure?](https://forum.inductiveautomation.com/t/where-do-should-gateway-scripts-live-with-respect-to-an-inherited-project-structure/83460/3):
>
> Put all of the logic in project library scripts, in the "universe" project at the root of your hierarchy, if you must. Then, in leaf projects, use one-line calls to the appropriate logic from event scripts and message handlers. (I don't agree with your desire, but this is what you must do to achieve it.) I recommend you not put all your scripts (eggs) in one inheritable project (basket). I recommend a hierarchy something like this: universe ├bg\_common │├gsp │├background1 │├background2 │└we…

---

_[View the full topic](https://forum.inductiveautomation.com/t/gateway-scripts-best-practice/109017)._
