Disabling spinner for timeout limits

I am trying to keep the session from timing out. I created a timer, but I think I am making a mistake somewhere in my code. The problem is that the server spinner keeps displaying nonestop.

What I’ve tried and what’s not working:

MY SERVER  CODE
@anvil.server.callable
def ping():
  return "pong"

MY FORM CODE
def timer_1_tick(self, **event_args):
    Timer(interval=300)
    anvil.server.call('ping')

I want it to keep sending that “pong” return every 5 min without the spinner. How do I do that?

Clone link:
Anvil | Login

If you do: anvil.server.call_s("ping") then it should remove the Spinner from server calls (assuming the functionality is working properly, and that the spinner is just in the way).

You could also do:

def timer_1_tick(self, **event_args):
    Timer(interval=300)
    with anvil.server.no_loading_indicator:
       anvil.server.call("pong")
1 Like

So this worked but I want to understand why It worked for learning purposes. I am still new to python and coding in general.

def timer_1_tick(self, **event_args):
    Timer(interval=300)
    with anvil.server.no_loading_indicator:
       anvil.server.call("pong")

It’s not so much a coding/python aspect since enclosing the function in that with block is a feature in the documentation that’s inherent to Anvil.