# Using runScript from alarm pipeline expression block

**URL:** <https://forum.inductiveautomation.com/t/using-runscript-from-alarm-pipeline-expression-block/8677>\
**Category:** Ignition\
**Created:** [July 7, 2014, 8:24pm UTC](https://forum.inductiveautomation.com/t/using-runscript-from-alarm-pipeline-expression-block/8677 "2014-07-07T20:24:28Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![chache](https://avatars.discourse-cdn.com/v4/letter/c/90db22/32.png) [@chache](https://forum.inductiveautomation.com/u/chache)\
**Post date:** [July 7, 2014, 8:24pm UTC](https://forum.inductiveautomation.com/t/using-runscript-from-alarm-pipeline-expression-block/8677/1 "2014-07-07T20:24:28Z")

</div>

Hi all,

I’m trying to call an app.\* script from an expression block.

In other parts of the client I can simply do:

```auto
runScript("app.utils.doSomething()")
```

But when I put that in an expression block in my alarm pipeline and then try to test it, the following gets put in the logs: NameError: name ‘app’ is not defined

Is there a way to call the app.\* scripts from inside an alarm pipeline’s expression block?

Regards,  
Charles

---

<div class="post-metadata">

**Author:** ![chache](https://avatars.discourse-cdn.com/v4/letter/c/90db22/32.png) [@chache](https://forum.inductiveautomation.com/u/chache)\
**Post date:** [July 8, 2014, 4:01pm UTC](https://forum.inductiveautomation.com/t/using-runscript-from-alarm-pipeline-expression-block/8677/2 "2014-07-08T16:01:33Z")

</div>

From what I can tell it is a scoping issue - the pipeline is global so it doesn’t know about the app.\* modules.

If that’s the case - does anyone know if it is possible to trigger something when an alarm happens? My goal was to have an expression block that did a bit of SQL work whenever there was an alarm so all our other systems would be aware. Without being able to call a script from the pipeline I’m not sure how this could be done, other than a timer constantly checking if any new alarms have come in, which is a pretty kludgy solution.

Anyone else having fun trying to integrate the Ignition alarms with other systems?

Charles

---

<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:** [July 8, 2014, 6:01pm UTC](https://forum.inductiveautomation.com/t/using-runscript-from-alarm-pipeline-expression-block/8677/3 "2014-07-08T18:01:17Z")

</div>

You’re right - it’s a scoping issue.

Two things are coming that will help you out here:

1. In 7.7 there’s going to be globally scoped scripting area, which should work in runScript calls from the pipelines.
2. We’ve been meaning, all along, to add a new kind of pipeline block that’s dedicated to executing a script. This would be the more elegant solution you’re looking for. I don’t know the timeline on this, hopefully soon after the release.

---

<div class="post-metadata">

**Author:** ![chache](https://avatars.discourse-cdn.com/v4/letter/c/90db22/32.png) [@chache](https://forum.inductiveautomation.com/u/chache)\
**Post date:** [July 9, 2014, 6:21pm UTC](https://forum.inductiveautomation.com/t/using-runscript-from-alarm-pipeline-expression-block/8677/4 "2014-07-09T18:21:57Z")

</div>

Good to hear that some of that stuff is on the way down the pipe - now I don’t feel so bad about using a kludgy solution.

In the meantime the system.\* scripts work fine in the expression blocks, so I’ve worked around with those to call my scripts.

Thanks,  
Charles
