# How to use runScript(app.\*) in expression tag (can't)

**URL:** <https://forum.inductiveautomation.com/t/how-to-use-runscript-app-in-expression-tag-cant/7940>\
**Category:** Ignition\
**Created:** [February 3, 2014, 2:24am UTC](https://forum.inductiveautomation.com/t/how-to-use-runscript-app-in-expression-tag-cant/7940 "2014-02-03T02:24:29Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![witman](https://avatars.discourse-cdn.com/v4/letter/w/d2c977/32.png) [@witman](https://forum.inductiveautomation.com/u/witman)\
**Post date:** [February 3, 2014, 2:24am UTC](https://forum.inductiveautomation.com/t/how-to-use-runscript-app-in-expression-tag-cant/7940/1 "2014-02-03T02:24:29Z")

</div>

A simple script to turn milliseconds into time:  
[attachment=4]Script Module Editor - app.test 2014.02.02 175135.jpg[/attachment]  
Tests out as expected in Script Playground:  
[attachment=3]Interactive Script Tester 2014.02.02 175223.jpg[/attachment]  
Tag created to display script result:  
[attachment=2]Tag Editor 2014.02.02 175411.jpg[/attachment]  
[attachment=1]Tag Editor 2014.02.02 175419.jpg[/attachment]  
But the tag gets a null value (evaluation error) instead:  
[attachment=0]Ignition Designer 2014.02.02 181118.bmp.jpg[/attachment]  
What am I missing here?

---

<div class="post-metadata">

**Author:** ![witman](https://avatars.discourse-cdn.com/v4/letter/w/d2c977/32.png) [@witman](https://forum.inductiveautomation.com/u/witman)\
**Post date:** [February 3, 2014, 2:30am UTC](https://forum.inductiveautomation.com/t/how-to-use-runscript-app-in-expression-tag-cant/7940/2 "2014-02-03T02:30:14Z")

</div>

Right-click-\>Tag Diagnostics doesn’t give any useful information at all in this case:  
[attachment=0]Tag Diagnostics.jpg[/attachment]  
Tag Diagnostics does work as expected on another test expression tag the same as in original post above, except that its expression is simply:

```auto
now()
```

With some more testing, it seems like we get the same results with any expression tag (DateTime, Int4, and String all tested) using runScript as the expression (calling scripts returning datetime, 1, or ‘string’, respectively). Seems this can’t really be completely broken… I must be missing something simple. This is on Ignition 7.6.4 (b2013112117) | 32-bit.

---

<div class="post-metadata">

**Author:** ![nmudge](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/nmudge/32/3394_2.png) [@nmudge](https://forum.inductiveautomation.com/u/nmudge)\
**Post date:** [February 3, 2014, 3:07am UTC](https://forum.inductiveautomation.com/t/how-to-use-runscript-app-in-expression-tag-cant/7940/3 "2014-02-03T03:07:07Z")

</div>

Hi witman,

Here’s what you are missing: expression tags don’t belong to any one project; they are shared by all projects. app.\* modules are specific to the projects they are defined in.

In an expression tag the runScript function doesn’t know which project’s app.mod.func to call, so it doesn’t call any of them.

I think this problem will be solved in Ignition 7.7 when global scripts are introduced. Global scripts are defined in one place and can be used by multiple projects so I would think they could be used in an expression tag’s runScript function.

You can still run one line Python scripts in expression tag runScript expressions, but referencing any app.\* Python code doesn’t work.

---

<div class="post-metadata">

**Author:** ![witman](https://avatars.discourse-cdn.com/v4/letter/w/d2c977/32.png) [@witman](https://forum.inductiveautomation.com/u/witman)\
**Post date:** [February 3, 2014, 3:21am UTC](https://forum.inductiveautomation.com/t/how-to-use-runscript-app-in-expression-tag-cant/7940/4 "2014-02-03T03:21:51Z")

</div>

Thanks nmudge; that makes sense. Global scripts will be a good thing. Meanwhile we can work around this by putting the runScript in an expression binding on a component’s property (instead of in an expression tag).

---

<div class="post-metadata">

**Author:** ![malleblas](https://avatars.discourse-cdn.com/v4/letter/m/ea666f/32.png) [@malleblas](https://forum.inductiveautomation.com/u/malleblas)\
**Post date:** [February 5, 2014, 3:19am UTC](https://forum.inductiveautomation.com/t/how-to-use-runscript-app-in-expression-tag-cant/7940/5 "2014-02-05T03:19:21Z")

</div>

Do event scripts (client) have this problem also? I seem unable to call a predefined script in a module.

---

<div class="post-metadata">

**Author:** ![nmudge](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/nmudge/32/3394_2.png) [@nmudge](https://forum.inductiveautomation.com/u/nmudge)\
**Post date:** [February 5, 2014, 4:30am UTC](https://forum.inductiveautomation.com/t/how-to-use-runscript-app-in-expression-tag-cant/7940/6 "2014-02-05T04:30:21Z")

</div>

No, event scripts do not have this problem. Something else must be the problem.
