Looking to create a module that purely introduces new methods and classes for the Jython Scripting part of Ignition.
I have looked through the SDK Programmers Guide and can't see much information on this. So the questions I have are:
Will I need to use a different Maven Archetype to create this module? Currently, using the "vision-component-archetype". I assume it would be the client-designer-gateway-archetype?
Is there any documentation on how script like this is implemented? Currently, will be creating scripts that runs in the client scope (the script will be used in Vision), but knowing how to create a module that will work on perspective and be able to use both Gateway and Client Scopes would be interesting.
I assume the documentation includes some examples. But if not, if anyone has any idea where there are some examples showing some examples it will be appreciated.
I wouldn't restrict yourself to learning how things work by sticking too closely to our (effectively abandoned) archetypes. The scopes your module supports are a function of the defined Maven modules and the module plugin configuration:
You will want to understand how these things fundamentally glue together.
There might be a fundamental disconnect in your understanding here.
The "scope" of a script really means "which JVM is it being run by", which will exclusively be one of the following:
Gateway
Designer
Vision client
There's really no independent Perspective scope - it's just the gateway scope, but with some thread-local context implicitly defined that allows the system.perspective functions to work without qualification.
Your module can opt-in to providing scripting functions to the platform by overriding the initializeScriptManager call. Ignition will call this function, automatically, in the platform, when constructing new ScriptManager instances, to allow modules to add their own extensions to the system function namespace.
If you choose to provide a client scoped scripting function that is capable of, or requires, communication with the gateway, you've entered the world of RPC, which is (somewhat confusingly) tangled up in the example module Kevin linked above, but it is by no means a requirement to have a client scoped scripting function.
You can easily define scripting function logic that will be run on the local JVM and just introduce it in each respective module hook, e.g.
The specific process of exposing Java methods and objects to Jython is complicated and full of subtleties that are hard to cover concisely.
Huge thanks @PGriffith and @Kevin.Herron, looked through all that has been sent and this thread contains a lot of useful information. I hope it can help others as much as it has helped me!