How to end infinite while loop from uplink

here’s some pseudo code that might help

## uplink code
AUTO_MODE = True

def run_auto_mode():
    while AUTO_MODE:
        # your logic above 


@anvil.server.callable
def coop_auto_mode():
    global AUTO_MODE
    AUTO_MODE = True
    # run auto mode
    coop = threading.Thread(target=run_auto_mode)
    coop.start()

@anvil.server.callable
def stop_auto_mode():
    global AUTO_MODE
    AUTO_MODE = False

You might also explore other ways to stop threads
example article Python | Different ways to kill a Thread - GeeksforGeeks

side note: it’s best to present code snippets using back ticks (for code formatting) rather than screen shots.

```python
def say_hello(name):
   print("Hello, %s" % name)
```

Let’s focus on this part for now - it’s good to split questions so perhaps create a new topic about your databindings question so as not to muddle the conversation. Remember to follow the guide lines form

How to ask a good question

2 Likes