Name "Shared" is not defined

Hello folks,

I come to you for help with an issue that I can’t seem to resolve by myself.
I have an expression tag that calls a script:
image

This script is defined in a Global Project, under Shared.Rsu:
image

This works wonderfully in another project, that I exported then imported in this new project, for which it doesn’t work. The logs tell me the name Shared is not defined:

I can call it from the script console with no issue:

Could anybody help me figure out what’s going on here ? A misconfiguration of some sort ?

Thanks and good day to you wonderful people !

If your running that on a tag, you can only run scripts from one project as tags are executed in the gateway only...

Using the Project Library in a Tag Event Script

Scripts defined in a project script can be called from a Tag Event Script. However, only scripts defined in the Gateway Script Project may be used. For more information on configuring the Gateway Scripting Project, please see the Project Library page.

2 Likes

I think you are missing the parentheses in runscript

https://docs.inductiveautomation.com/display/DOC80/runScript

In the gateway settings verify the gateway scripting project is set to global (or the name of your global project housing the scripts)

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

There shouldn’t be any issue with scoping, as this exact setup and script works for another project…

@lachguerabdallah The parentheses are there, just not on the same line.

@tim Thanks, That might very well be the root of the issue, the Gateway scripting project wasn’t set. I’m trying that right now.

Yep, that was it… Thanks a lot !