Import Error on Gateway Scripting (no module named client)

Hello,

I call a gateway scripting from a tag change event gateway, and inside this script I call a web service function using Sepasoft Web Services (Project MESGateway).
My problem is to import the function GatewayException lik this example:

import com.inductiveautomation.ignition.client.gateway_interface.GatewayException as GatewayException

Reference: Timeout Exception in RESTful Applications 3.0 - Knowledge Base - Sepasoft MES Help Documentation

Running with gateway scripts (Gateway Scope), when occurrs a exception, I receive an error like:
ImportError: Error loading module: Traceback line 2, in ImportError: No module named client

But, using Scripting Console, the same python script, this import works.
Any idea?

The script console is running on your local machine where the designer is - so it's the "designer" scope. When you're running on the gateway scope, you have access to a totally different set of Java libraries and imports.

That Sepasoft article is suggesting you import the 'GatewayException' class (under the client package) because that's how exceptions thrown by code on the gateway are delivered to the designer and client scopes - wrapped up into GatewayException instances.

In a script running entirely on the gateway, there's no need for that indirection, because you'll have direct access to whatever exception is being thrown. Simply stop trying to catch it/importing GatewayException in the wrong scope and see what actual timeout exception is being thrown, and adjust your gateway side code to catch that exception.