Executing server code on anvil server if uplink not available

In fact, you can do it a bit more simply. When you anvil.server.call() a function, then if that function is defined on an Uplink connection, you call the Uplink; otherwise you try a server module, and if the function isn’t found there either then you get an exception.

This means that both your Uplink and your server module can define the server_code function, and anvil.server.call('server_code') will execute on the Uplink if it’s available, and in server modules if it’s not.

5 Likes