How to connect multiple google colab notebooks?

I have multiple programs, each requiring its own tensorflow and other library specific environment.

When I tried combining all of them into one google colab notebook, since the versions of certain libraries change in the middle, google colab asks to restart runtime, and therefore the web app execution stops, and I have to manually restart in Google colab and then again execute the webapp.

Is there a way to connect multiple virtual environments in multiple Google colab notebooks for a single web app?

Hi @kartha.vijaykumar

Are you using the Uplink to connect your Google colab notebooks to your Anvil app?

You can connect multiple Uplink instances to the same app. If they each have different functions, Anvil will know which one has the right function (I think!), so you should be able to just call the function as normal in your app and Anvil will know which Uplink to call that function from.

If you use the same function names in each Uplink, your app will load-balance between the different Uplink instances.

You can also change the name that the app uses to refer to the Uplink function by passing a string to the decorator like so:

# On the server
@anvil.server.callable('custom_function_name')
def get_data():
  return [1, 2, 3, 4, 5]

# On the client
anvil.server.call('custom_function_name')

This allows you to assign an ID to each Uplink and manually select which Uplink to call a particular function from, even if the functions have the same name in the Uplink script:

MY_ID = #...something..

if not app_tables.hosts.get(id=MY_ID):
  app_tables.hosts.add_row(id=MY_ID)

@anvil.server.callable("func_" + MY_ID)
def f():
  print "Hello from host %s" % MY_ID

For more info about using multiple Uplinks, see these threads:

3 Likes