# Shared Script from Gateway Event in 8.0

**URL:** <https://forum.inductiveautomation.com/t/shared-script-from-gateway-event-in-8-0/24533>\
**Category:** Ignition\
**Tags:** ignition80\
**Created:** [April 30, 2019, 10:48pm UTC](https://forum.inductiveautomation.com/t/shared-script-from-gateway-event-in-8-0/24533 "2019-04-30T22:48:32Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![shawn](https://avatars.discourse-cdn.com/v4/letter/s/f6c823/32.png) [@shawn](https://forum.inductiveautomation.com/u/shawn)\
**Post date:** [April 30, 2019, 10:48pm UTC](https://forum.inductiveautomation.com/t/shared-script-from-gateway-event-in-8-0/24533/1 "2019-04-30T22:48:32Z")

</div>

How should I call a shared script from a Gateway Timer Event in 8.0? I’ve created a project named “Shared”, added a project library named “paintLine” to it, and set it as the “Gateway Scripting Project” in the gateway configuration.

In another project I have a Gateway Timer Event and I’ve tried using:  
shared.paintLine.SomeMethod()  
Shared.paintLine.SomeMethod()  
paintLine.SomeMethod()

These fail with:  
“No module named shared”  
“NameError: name ‘Shared’ is not defined”  
“NameError: name ‘paintLine’ is not defined”

What is the right way to do this?

---

<div class="post-metadata">

**Author:** ![Kevin.Herron](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/kevin.herron/32/7259_2.png) [@Kevin.Herron](https://forum.inductiveautomation.com/u/Kevin.Herron)\
**Post date:** [April 30, 2019, 10:53pm UTC](https://forum.inductiveautomation.com/t/shared-script-from-gateway-event-in-8-0/24533/2 "2019-04-30T22:53:34Z")

</div>

That setting is for scripts executing on the gateway that aren’t tied to a project - like in tags.

Gateway Event Scripts belong to a project and so your script package should be defined there (or in any project that the current project inherits from).

---

<div class="post-metadata">

**Author:** ![shawn](https://avatars.discourse-cdn.com/v4/letter/s/f6c823/32.png) [@shawn](https://forum.inductiveautomation.com/u/shawn)\
**Post date:** [May 1, 2019, 12:29am UTC](https://forum.inductiveautomation.com/t/shared-script-from-gateway-event-in-8-0/24533/3 "2019-05-01T00:29:56Z")

</div>

Ok, that is helpful to know.

So, I copied the methods into the same project that has the gateway event and put them in a library named “util”.

When trying from the gateway timer event:  
util.SomeMethod()  
project.util.SomeMethod()

fail with:  
“NameError: global name ‘util’ is not defined”  
“NameError: global name ‘project’ is not defined”

Is there some syntax I’m missing?

---

<div class="post-metadata">

**Author:** ![paul-griffith](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/paul-griffith/32/37249_2.png) [@paul-griffith](https://forum.inductiveautomation.com/u/paul-griffith)\
**Post date:** [May 1, 2019, 4:10pm UTC](https://forum.inductiveautomation.com/t/shared-script-from-gateway-event-in-8-0/24533/4 "2019-05-01T16:10:16Z")

</div>

If you’re able to, try on 8.0.1 - there were some bugs about package management that are fixed in the RC.

---

<div class="post-metadata">

**Author:** ![shawn](https://avatars.discourse-cdn.com/v4/letter/s/f6c823/32.png) [@shawn](https://forum.inductiveautomation.com/u/shawn)\
**Post date:** [May 1, 2019, 8:21pm UTC](https://forum.inductiveautomation.com/t/shared-script-from-gateway-event-in-8-0/24533/5 "2019-05-01T20:21:45Z")

</div>

Thank you, 8.0.1rc1 fixed the issue.

---

<div class="post-metadata">

**Author:** ![RC23](https://avatars.discourse-cdn.com/v4/letter/r/e36b37/32.png) [@RC23](https://forum.inductiveautomation.com/u/RC23)\
**Post date:** [April 27, 2022, 1:26pm UTC](https://forum.inductiveautomation.com/t/shared-script-from-gateway-event-in-8-0/24533/6 "2022-04-27T13:26:26Z")

</div>

Has this been changed/improved in 8.1.13? I’d like to have my gateway events in a separate project and available/callable for other projects?

---

<div class="post-metadata">

**Author:** ![Kevin.Herron](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/kevin.herron/32/7259_2.png) [@Kevin.Herron](https://forum.inductiveautomation.com/u/Kevin.Herron)\
**Post date:** [April 27, 2022, 1:37pm UTC](https://forum.inductiveautomation.com/t/shared-script-from-gateway-event-in-8-0/24533/7 "2022-04-27T13:37:58Z")

</div>

There’s no intention to change this.

Gateway Event Scripts aren’t how you encapsulate code you want to share between projects - use packages and scripts defined in the Project Library of a project that others will inherit.

---

<div class="post-metadata">

**Author:** ![RC23](https://avatars.discourse-cdn.com/v4/letter/r/e36b37/32.png) [@RC23](https://forum.inductiveautomation.com/u/RC23)\
**Post date:** [April 27, 2022, 1:40pm UTC](https://forum.inductiveautomation.com/t/shared-script-from-gateway-event-in-8-0/24533/8 "2022-04-27T13:40:00Z")

</div>

Thank you very much for the info!
