You are currently viewing the new Beta Editor Docs.
Switch to the Classic Editor Docs
You are currently viewing the Classic Editor Docs.
Switch to the Beta Editor Docs

Uplink: Code outside Anvil

Sometimes you want to write some server-side code that can’t run on our servers. Perhaps it needs resources that are only available on your company network, or on your computer.

You can connect code anywhere on the Internet to your Anvil app using the Anvil Uplink - check the Quickstart to get up and running.

The Uplink makes any Python code behave like a Server Module: you can call functions in it from your app using The connection goes both ways; you can into your app from the Uplink.

Anything you can do in a Server Module can also be done from the Uplink - using app_tables to search and modify your Data Tables, or using anvil.users.get_user() to check who’s logged in, for example.

It’s common to use the Uplink to connect to a Jupyter Notebook to create an Anvil front-end for your Data Science models. Here’s a tutorial video where we do just that.

Here’s a script that you can run on your own machine and connect to your app.

import anvil.server

anvil.server.connect("<your Uplink key>")

def get_data(name):
  print(f"Hello from your own machine, {name}!")
  return [1, 2, 4, 8]


To run this, you need to pip install anvil-uplink and enable the Uplink in the Anvil Editor - see Setting Up for complete instructions.