Call function from script library in gateway event scripts

Maybe somebody knows how i can call function from script library in gateway event scripts?
Example i have script “myfuncs” with function “myFunction”. I have tryed call function in this way:


but nothing happened.

Function has worked in script console.

It depends on where your event script is placed. If it is a tag event, you can’t use ‘project.’ scripts. You can only use 'shared.’ scripts. Tags aren’t part of a project, so no project resources are available. If you need to trigger on tag changes in a project context, use the project’s event scripts. Same sort of thing applies to any of the global events.

Gateway scripts can’t access project resources, so you’ll have to make sure your scripts are stored in Global / Script Library (shared). In your gateway event script, call your script using shared.myfuncs.myFunction()

I’m calling a project script from a Gateway Event Script. Now I’m confused as to why that’s working. But it’s definitely working. Perhaps I’m misunderstanding the question or the terminology? Under “Project”, there is a section called “Scripts.” Underneath it are “Script Library [project]”, “Client Event Scripts”, and “Gateway Event Scripts.” I’ve added a timer event in the Gateway Even Scripts. It calls project.my_funcs.my_func() with no issues. Under “Global” I have a “Script Library [shared]” but no “Gateway Event Scripts [shared]” or similar. I have no shared scripts at all, so I know I’m not accidentally calling the wrong thing. So what am I missing here? Using version 7.9.9

These belong to a project. They aren’t the same thing as a tag change script that is defined on a tag.

1 Like