When you connect to an uplink, the functions available are “registered” with the anvil server by name.
You can override this behavior by passing a new function string name into the @...callable()
decorator, and this can be done programmatically.
So if you assigned each pico its own ID (or let it pick something of its own like a unique hardware identifier or an email address or hash of some personal info) then you can do something like:
## This is pico 1
UNIQUE_ID = "01"
@anvil.pico.callable_async(f"{ UNIQUE_ID }_blinky_func")
def blinky_func(color, duration):
# This is pseudo code,
# you would make a function for this to work
pico_blink(color, duration)
anvil.pico.connect("<ALL-THE-SAME-UPLINK-KEY>")
## This is pico 2
UNIQUE_ID = "02"
@anvil.pico.callable_async(f"{ UNIQUE_ID }_blinky_func")
def blinky_func(color, duration):
# This is pseudo code,
# you would make a function for this to work
pico_blink(color, duration)
anvil.pico.connect("<ALL-THE-SAME-UPLINK-KEY>")
## This is pico 3
UNIQUE_ID = "03"
@anvil.pico.callable_async(f"{ UNIQUE_ID }_blinky_func")
def blinky_func(color, duration):
# This is pseudo code,
# you would make a function for this to work
pico_blink(color, duration)
anvil.pico.connect("<ALL-THE-SAME-UPLINK-KEY>")
# in the anvil cloud server module
def july_fourth_blink():
anvil.server.call("01_blinky_func", "red", 0.33)
anvil.server.call("02_blinky_func", "white", 0.33)
anvil.server.call("03_blinky_func", "blue", 0.33)
Then when you call july_fourth_blink()
from the server module after running the uplink on all three picos correctly, you should get them to blink red, white, then blue within around a second of each other.