# Expression Tag - runScript

**URL:** <https://forum.inductiveautomation.com/t/expression-tag-runscript/103050>\
**Category:** Ignition\
**Tags:** scripting\
**Created:** [February 28, 2025, 2:52pm UTC](https://forum.inductiveautomation.com/t/expression-tag-runscript/103050 "2025-02-28T14:52:06Z")\
**Posts on this page:** 10\
**Page:** 1

<div class="post-metadata">

**Author:** ![Filarm27](https://avatars.discourse-cdn.com/v4/letter/f/b9bd4f/32.png) [@Filarm27](https://forum.inductiveautomation.com/u/Filarm27)\
**Post date:** [February 28, 2025, 2:52pm UTC](https://forum.inductiveautomation.com/t/expression-tag-runscript/103050/1 "2025-02-28T14:52:06Z")

</div>

Hi,  
I am trying to run a script placed inside the Project Library via an Expression Tag.

The script is as follows:

```python
def MyPath():
  
       ... example script ...

```

The Expression Tag is set as follows:

- data Type: Float
- execution mode: Fixed Rate
- execution rate (ms): 5.000

The expression is as follows:

```python
runScript( "MyPath()", 0 )

```

The tag result is: Error\_ExpressionEval

I already tried to run the script in the Script Console and I get the right output value.

Suggestions?

Thanks to all.

---

<div class="post-metadata">

**Author:** ![Cory.grube](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/cory.grube/32/20476_2.png) [@Cory.grube](https://forum.inductiveautomation.com/u/Cory.grube)\
**Post date:** [February 28, 2025, 2:58pm UTC](https://forum.inductiveautomation.com/t/expression-tag-runscript/103050/2 "2025-02-28T14:58:30Z")

</div>

Two main things I see:

- `runScript` needs to reference the package/script file where your function is defined
- The function should be called without parentheses

E.g. if `MyPath` is defined in file `MyScriptFile`, your expression would be:

```python
runScript("MyScriptFile.MyPath", 0)

```

If there are still issues, I'd guess it's an error within the script itself.

---

<div class="post-metadata">

**Author:** ![bschroeder](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/bschroeder/32/13260_2.png) [@bschroeder](https://forum.inductiveautomation.com/u/bschroeder)\
**Post date:** [February 28, 2025, 2:59pm UTC](https://forum.inductiveautomation.com/t/expression-tag-runscript/103050/3 "2025-02-28T14:59:33Z")

</div>

> [@Cory.grube](#):
>
> The function should be called without parentheses

Actually according to the docs: [runScript | Ignition User Manual](https://docs.inductiveautomation.com/docs/8.1/appendix/expression-functions/advanced/runScript) with parentheses is fine as a legacy.

What version of Ignition are you using?

---

<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:** [February 28, 2025, 3:06pm UTC](https://forum.inductiveautomation.com/t/expression-tag-runscript/103050/4 "2025-02-28T15:06:50Z")

</div>

Use parenthesis when there are no arguments to pass. And then the full line of text will be executed.

Use no parenthesis when the line of text identifies a callable function, and there are arguments to pass included after the poll time argument.

---

<div class="post-metadata">

**Author:** ![Filarm27](https://avatars.discourse-cdn.com/v4/letter/f/b9bd4f/32.png) [@Filarm27](https://forum.inductiveautomation.com/u/Filarm27)\
**Post date:** [February 28, 2025, 3:08pm UTC](https://forum.inductiveautomation.com/t/expression-tag-runscript/103050/5 "2025-02-28T15:08:10Z")

</div>

The path of the script in the Project Library is:

```python
Production/Dashboard

```

and the function definition is:

```python
def production_1():

```

so the expression runScript is:

```python
runScript( "Production.Dashboard.production_1()", 0 )

```

---

<div class="post-metadata">

**Author:** ![Filarm27](https://avatars.discourse-cdn.com/v4/letter/f/b9bd4f/32.png) [@Filarm27](https://forum.inductiveautomation.com/u/Filarm27)\
**Post date:** [February 28, 2025, 3:08pm UTC](https://forum.inductiveautomation.com/t/expression-tag-runscript/103050/6 "2025-02-28T15:08:53Z")

</div>

`8.1.42`

---

<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:** [February 28, 2025, 3:10pm UTC](https://forum.inductiveautomation.com/t/expression-tag-runscript/103050/7 "2025-02-28T15:10:48Z")

</div>

Is that script library in your gateway scripting project? Expression tags using `runScript()`, and any tags' event scripts, can only use scripts in the GSP. If that isn't configured, it simply won't work.

If you open the tag for editing in the designer, the tag diagnostics button (upper right) will probably give you more detail on that error.

---

<div class="post-metadata">

**Author:** ![Filarm27](https://avatars.discourse-cdn.com/v4/letter/f/b9bd4f/32.png) [@Filarm27](https://forum.inductiveautomation.com/u/Filarm27)\
**Post date:** [February 28, 2025, 3:19pm UTC](https://forum.inductiveautomation.com/t/expression-tag-runscript/103050/8 "2025-02-28T15:19:43Z")

</div>

I am sorry. What do you mean with "gateway scripting project"?

The diagnostic button give me this:

[null, Error\_ExpressionEval("Error executing script for runScript() expresion: Production.Dashboard.production\_1")]

---

<div class="post-metadata">

**Author:** ![bschroeder](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/bschroeder/32/13260_2.png) [@bschroeder](https://forum.inductiveautomation.com/u/bschroeder)\
**Post date:** [February 28, 2025, 3:21pm UTC](https://forum.inductiveautomation.com/t/expression-tag-runscript/103050/9 "2025-02-28T15:21:22Z")

</div>

> [@Filarm27](#):
>
> gateway scripting project

Since tags aren't a project resource, a specific project must be identified as the gateway scripting project. See this portion of the manual: [Project Library | Ignition User Manual](https://docs.inductiveautomation.com/docs/8.1/platform/scripting/scripting-in-ignition/project-library#gateway-scripting-project)

Then the tag will know how to get to the project library for the function that you are calling.

---

<div class="post-metadata">

**Author:** ![Cory.grube](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/cory.grube/32/20476_2.png) [@Cory.grube](https://forum.inductiveautomation.com/u/Cory.grube)\
**Post date:** [February 28, 2025, 7:40pm UTC](https://forum.inductiveautomation.com/t/expression-tag-runscript/103050/10 "2025-02-28T19:40:24Z")

</div>

> [@bschroeder](#):
>
> Actually according to the docs: [runScript | Ignition User Manual](https://docs.inductiveautomation.com/docs/8.1/appendix/expression-functions/advanced/runScript) with parentheses is fine as a legacy.

Appreciate the info! I've always used the modern syntax, forgot legacy was an option.
