What I don’t like is that until I see an Anvil message in the console saying “Connected/Authenticated…” none of the functions work. Anvil freezes all functions while connecting. I also checked anvil.pico.connect_async but the result was the same. If there’s no workaround, maybe there’s a way to run my own function when authentication happens?
You can certainly run your own functions when authentication happens! See on_first_connect and on_every_connect in the docs: Anvil Docs | Uplink for Pico W
>>>
MPY: soft reboot
<CYW43 STA up 192.168.0.164>
<CYW43 STA up 192.168.0.164>
on_first_connect
Connecting to Anvil...
Connected
Authenticated to app XXXXXXXXXXX
Here you are calling print('on_first_connect'), which returns None, and then you’re passing that None to the connect_async function. Try passing an ordinary function to on_first_connect, and that should work just fine!