# Derived Tag using runScript in Write Expression errors out, even in simplest case

**URL:** <https://forum.inductiveautomation.com/t/derived-tag-using-runscript-in-write-expression-errors-out-even-in-simplest-case/74604>\
**Category:** Ignition\
**Tags:** vision\
**Created:** [June 6, 2023, 12:16am UTC](https://forum.inductiveautomation.com/t/derived-tag-using-runscript-in-write-expression-errors-out-even-in-simplest-case/74604 "2023-06-06T00:16:07Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![sherman](https://avatars.discourse-cdn.com/v4/letter/s/e5b9ba/32.png) [@sherman](https://forum.inductiveautomation.com/u/sherman)\
**Post date:** [June 6, 2023, 12:16am UTC](https://forum.inductiveautomation.com/t/derived-tag-using-runscript-in-write-expression-errors-out-even-in-simplest-case/74604/1 "2023-06-06T00:16:07Z")

</div>

I am trying to run a script to handle my Write Expression in a Derived tag. I wrote a script that simply returns a value, and call it in the Write Expression, and when I try to change the value of the tag, all I get is

```auto
Error writing to setpoint.value: Error_ExpressionEval 

```

I have tried to replace runScript("MyScripts.static\_value") with the actual value of `static_value`, and it works just fine. But I can't seem to get the script to run in the same spot!

```auto
def static_value():
    return 0.333

```

Is this not possible? I can select runScript from the binding popup that comes with the control itself, I am not forcing it into a place it is not to be selected, so I am not sure. [The documentation](https://docs.inductiveautomation.com/display/DOC81/runScript?gclid=Cj0KCQjwj_ajBhCqARIsAA37s0wwkNKgAOpn7aVilL34VaJsZh96WOlPcnLKpzx7GREJMVzrZmKvZ2saAqU3EALw_wcB) for runScript mentions nothing about not being allowed to use these in a Derived tag.

Also, is there a way to get a more verbose Error\_ExpressionEval?

---

<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:** [June 6, 2023, 12:27am UTC](https://forum.inductiveautomation.com/t/derived-tag-using-runscript-in-write-expression-errors-out-even-in-simplest-case/74604/2 "2023-06-06T00:27:30Z")

</div>

Do you have the gateway scripting project set?

---

<div class="post-metadata">

**Author:** ![sherman](https://avatars.discourse-cdn.com/v4/letter/s/e5b9ba/32.png) [@sherman](https://forum.inductiveautomation.com/u/sherman)\
**Post date:** [June 6, 2023, 1:07am UTC](https://forum.inductiveautomation.com/t/derived-tag-using-runscript-in-write-expression-errors-out-even-in-simplest-case/74604/3 "2023-06-06T01:07:15Z")

</div>

Where do I set this? I can't find anything in Project Properties, nor obviously in the Gateway Config. I changed the "Script Hint Scop" to Gateway to no apparent effect.

---

<div class="post-metadata">

**Author:** ![jlandwerlen](https://avatars.discourse-cdn.com/v4/letter/j/bc8723/32.png) [@jlandwerlen](https://forum.inductiveautomation.com/u/jlandwerlen)\
**Post date:** [June 6, 2023, 2:25am UTC](https://forum.inductiveautomation.com/t/derived-tag-using-runscript-in-write-expression-errors-out-even-in-simplest-case/74604/4 "2023-06-06T02:25:01Z")

</div>

[https://docs.inductiveautomation.com/display/DOC80/Project+Library#ProjectLibrary-GatewayScriptingProject](https://docs.inductiveautomation.com/display/DOC80/Project+Library#ProjectLibrary-GatewayScriptingProject)

---

<div class="post-metadata">

**Author:** ![sherman](https://avatars.discourse-cdn.com/v4/letter/s/e5b9ba/32.png) [@sherman](https://forum.inductiveautomation.com/u/sherman)\
**Post date:** [June 6, 2023, 2:43am UTC](https://forum.inductiveautomation.com/t/derived-tag-using-runscript-in-write-expression-errors-out-even-in-simplest-case/74604/5 "2023-06-06T02:43:21Z")

</div>

That did it, thank you. Hidden in Gateway Settings!

I guess I should just have a single project with all of my scripts?

---

<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:** [June 6, 2023, 12:11pm UTC](https://forum.inductiveautomation.com/t/derived-tag-using-runscript-in-write-expression-errors-out-even-in-simplest-case/74604/6 "2023-06-06T12:11:15Z")

</div>

Generally not. I recommend:

- an inheritable project with all of your extremely-well-tested generic functions, to be your root "global" project,

- zero or more inheritable projects (themselves inheriting root) with common GUI elements for sections of your project "tree",

- a leaf project with all of the functions your tag events need (inheriting from root), to be your global scripting project, and

- other leaf projects to be actual UIs and leaf projects to encapsulate complex gateway-only tasks.
