Seeing Collision warnings: addScriptModule

I have two classes that I want to make available to project scripts running on the gateway.
If I register one class, the module installs and starts up with no errors or warnings in the wrapper.log.

If I register both classes, warnings appear in the log, as shown below.

This is the code in the module:

public void initializeScriptManager(ScriptManager oScriptManager)
    oScriptManager.addScriptModule("xas", new MyClassA());
    oScriptManager.addScriptModule("xas", new MyClassB());

I’ve specified “xas” for the location, assuming I can create namespaces at will, so long as they are unique.

MyClassB extends MyClassA.

This is a typical warning at gateway startup:
INFO | jvm 1 | 2016/09/22 15:10:18 | Warning: collision at xas.Description

Description is a protected String in MyClassA, so it also visible in subclass MyClassB.

It seems to me that there should not be any path “xas.Description”. The class name should be in the path: xas.MyClassA.Description

I’m getting warnings for five of the six protected variables, and for one of the six public methods, that are declared in MyClassA.

I’m not getting any warnings for variables or methods declared in the subclass MyClassB.



Class instances that are registered as script modules have all of their methods turned into scripting functions. Which means that what you are trying to do cannot possibly work, as all methods of ClassA will be inherited in ClassB. Use a different namespace or don’t inherit.

I specified a different namespace for each class, as shown below.
No more warnings.
Don’t know if this actually works, as I have never written a line of Python code.
The Python Reference Manual is not particularly helpful as a tutorial.

public void initializeScriptManager(ScriptManager oScriptManager)
oScriptManager.addScriptModule(“xas.ClassA”, new MyClassA());
oScriptManager.addScriptModule(“xas.ClassB”, new MyClassB());

Reading the Python tutorial in the Ignition user manual.