Import GatewayContext

Hi,

I am using Ignition 8.1.17 and trying to import GatewayContext in gateway script. But it says module cannot be imported. Am I missing something to perform this:

from com.inductiveautomation.ignition.gateway import GatewayContext

Thanks,
Raj

This would only work in script executing in the gateway scope.

Where are you writing this script and executing it from?

Ah, actually, that’s not even the correct package: GatewayContext

2 Likes

Thanks much @Kevin.Herron. I am able to import it now.

However, my code doesn't seem to clear S&F quarantine items. I tried many ways to clear it. Can you help me clear this using script.


from com.inductiveautomation.ignition.gateway.history import QuarantineManager

quarantined_data_info = QuarantineManager.getQuarantinedDataInfo()

You are trying use classes as if they are instances. Your starting point needs to be an instance of an implementation of the GatewayContext interface. That is very much an undocumented and unsupported action, but you can find such techniques scattered across this forum. They are undocumented and unsupported because they expose things, that if mishandled, can and will crash your gateway.

I recommend you spend some time studying the SDK API.

1 Like