runScript and 3rd party python lib

I want to make use of a method from a 3rd party python lib (/var/lib/ignition/user-lib/pylib) inside runScript expression.

According to the online help for the runScript expression the scope has either to be “shared.” or “project.”. What is to use in connection with 3rd party libs. Is it possible?

What if you create a function in the project scripting scope that calls the function you want to use in the 3rd party python lib and gives you the return value?

1 Like

Or simply use from someModule import someFunction to pull the target function into a shared or project script’s scope. Then you can use project.scriptModule.someFunction in runScript().

1 Like

Thank for your suggestions. I thought it would be possible to use a function from a third party lib without the workaround to pull it into a project or shared scoped function.

Later a found an example in the online manual for the runScript expression:

Here is an example, where the root container has a custom function called "calculateAggregates(dataset)":
runScript("self.calculateAggregates", 0, {Root Container.MyDataSet})

This approach seems also to be a good solution.