Anvil Community Forum

Disconnect uplink

Probably a silly question, but once I’m connected to my app via uplink, how can I reconnect to a new app with uplink?

Just re-running anvil.server.connect(my_new_app_key) doesn’t disconnect the first connection, and so nothing changes.

There’s not currently a way to disconnect a running Uplink script using a Python function call - the way to disconnect a script is to kill the process! Moving to Feature Requests.

Is it possible for you to restart your script? You can pass the key in as an argument on the commandline, just write your connect call as:

import sys

anvil.server.connect(sys.argv[1])
1 Like

Hi Shaun,

Thanks for the advice.

Currently I got around this by simply running two separate scripts and saving what I need to disk.

1 Like

+1 on this Feature.

FWIW, I am using anvil uplink code inside a Jupyter Notebook … and an I am tweaking some of the return data, so it fairly annoying to kill Jupyter process in order to re-connect to uplink.

Having a programatic way to refresh connection would be useful.