# Using Scripting resources within Alarm Notification Pipeline not working

**URL:** <https://forum.inductiveautomation.com/t/using-scripting-resources-within-alarm-notification-pipeline-not-working/33011>\
**Category:** Ignition\
**Tags:** ignition80\
**Created:** [March 11, 2020, 3:48pm UTC](https://forum.inductiveautomation.com/t/using-scripting-resources-within-alarm-notification-pipeline-not-working/33011 "2020-03-11T15:48:03Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![md.szyman](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/md.szyman/32/9240_2.png) [@md.szyman](https://forum.inductiveautomation.com/u/md.szyman)\
**Post date:** [March 11, 2020, 3:48pm UTC](https://forum.inductiveautomation.com/t/using-scripting-resources-within-alarm-notification-pipeline-not-working/33011/1 "2020-03-11T15:48:03Z")

</div>

I have a Script block and I’m trying to call a function defined in another Script. However, each time I call it I get:

`NameError: global name 'MyScript' is not defined`

Or if I try to `import MyScript` inside of the alarm notification block, I get the error:

`ImportError: No module named MyScript`

Running the latest nightly.

---

<div class="post-metadata">

**Author:** ![justin.brzozoski](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/justin.brzozoski/32/13452_2.png) [@justin.brzozoski](https://forum.inductiveautomation.com/u/justin.brzozoski)\
**Post date:** [March 11, 2020, 7:12pm UTC](https://forum.inductiveautomation.com/t/using-scripting-resources-within-alarm-notification-pipeline-not-working/33011/2 "2020-03-11T19:12:04Z")

</div>

Sometimes the Jython instances don’t refresh/reload the imports right away.

I’ve found I can usually force a refresh if I make a trivial edit in the script in Designer then close the script and hit save.

Other things can apparently lead to this, for example [reusing script file names between multiple projects](http://forum.inductiveautomation.com/t/project-scripts-randomly-inaccessible-for-short-period/31043).

Also maybe read the links in that thread in the paragraph starting “I tried searching around in the forum…”

---

<div class="post-metadata">

**Author:** ![justin.brzozoski](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/justin.brzozoski/32/13452_2.png) [@justin.brzozoski](https://forum.inductiveautomation.com/u/justin.brzozoski)\
**Post date:** [March 11, 2020, 7:13pm UTC](https://forum.inductiveautomation.com/t/using-scripting-resources-within-alarm-notification-pipeline-not-working/33011/3 "2020-03-11T19:13:53Z")

</div>

Oh, also, alarm scripts run in the gateway context, not a specific project. You can only import/use script set in the “Gateway Scripting Project” from your global gateway settings.

---

<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:** [March 11, 2020, 7:16pm UTC](https://forum.inductiveautomation.com/t/using-scripting-resources-within-alarm-notification-pipeline-not-working/33011/4 "2020-03-11T19:16:20Z")

</div>

> [@justin.brzozoski](#):
>
> Oh, also, alarm scripts run in the gateway context, not a specific project. You can only import/use script set in the “Gateway Scripting Project” from your global gateway settings.

~~I don't think this is true in Ignition 8 - scripts in a notification pipeline block will run in the context of the project the pipeline is defined in, which could be his issue.~~

Hmm, I think I'm wrong here. Digging a little more.

update: yeah... it looks like despite pipelines belonging to a specific project now, the scriptable block was never updated to use the project script manager rather than the gateway one, which would be whatever is in the "global scripting project" setting.

---

<div class="post-metadata">

**Author:** ![md.szyman](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/md.szyman/32/9240_2.png) [@md.szyman](https://forum.inductiveautomation.com/u/md.szyman)\
**Post date:** [March 11, 2020, 7:23pm UTC](https://forum.inductiveautomation.com/t/using-scripting-resources-within-alarm-notification-pipeline-not-working/33011/5 "2020-03-11T19:23:45Z")

</div>

> [@Kevin.Herron](#):
>
> update: yeah… it looks like despite pipelines belonging to a specific project now, the scriptable block was never updated to use the project script manager rather than the gateway one, which would be whatever is in the “global scripting project” setting.

So that would mean this behavior is a bug? Or will I need to set a global scripting project in order for things to work properly?

---

<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:** [March 11, 2020, 7:31pm UTC](https://forum.inductiveautomation.com/t/using-scripting-resources-within-alarm-notification-pipeline-not-working/33011/6 "2020-03-11T19:31:02Z")

</div>

Well… my initial reaction to this screams “bug” but if we change this behavior now we’ll break existing pipeline script blocks. I’m not sure what we’ll do about it. Maybe it will have to become a configuration option whether it’s gateway or project scope and remain defaulted to gateway.

---

<div class="post-metadata">

**Author:** ![md.szyman](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/md.szyman/32/9240_2.png) [@md.szyman](https://forum.inductiveautomation.com/u/md.szyman)\
**Post date:** [March 11, 2020, 7:37pm UTC](https://forum.inductiveautomation.com/t/using-scripting-resources-within-alarm-notification-pipeline-not-working/33011/7 "2020-03-11T19:37:25Z")

</div>

I see! I’ll just update my global scripting project then. Thanks!
