Button onClick event NameError when calling script from script library

I have a global script library setup. I can call the scripts from it fine in tag change events and SFC from other projects. I am using the onClick Script action for a Perspective button, but when I try to call a script from the Script Library Project named NH-ScriptLibrary, I get an error.

Error running action 'dom.onClick' on P70X RD AUTO@D/root/Button: Traceback (most recent call last): File "<function:runAction>", line 35, in runAction NameError: global name 'plexAPI' is not defined

The code is

	response = plexAPI.setJob(checkJob, workcenterKey)

plexAPI is the name of the script in the Project NH-ScriptLibrary that is set as the Gateway Scripting Project.

I tried using the Project name, but the get "NameError: global name 'NH' is not defined".

I could be wrong, but it seems like in this scope it does not like the '-' in the project name. Or I am just missing something obvious.

Thanks,

Jon

I would assume the - is not a valid character for a package name as it is a reserved character in python.

The error is likely being generated by the NH being interpreted as a variable name in some sort of subtraction operation.

I would switch the hypen out for an underscore in the package name and try it out.

The gateway scripting project setting is not relevant when you're using a script from anywhere associated with a particular project (which is basically everywhere except for a tag). In that case, you're going to get your local project's script library (including any parent project(s)). You cannot reference library scripts in another project; you can only use those that are part of your inheritance tree.

Thus, it's usually a good idea for shared logic to have a "base" project that purely defines library scripts and truly global things, and inherit from that in all your other projects.