Anvil Pico W fails to run main program after reconnection

You’re both right! What’s going on here is that on_first_connect expects a reference to a function, so in your case @edmondssesay you’ll want main rather than main().

In the docs, the function being referred to is actually an async function, defined with async def, and that means it behaves slightly differently (calling it returns a generator). This is why, although the functions in the docs do return None, you call them anyway in the connect call, since that’s actually how you refer to an async function in this context.

We’ll update the docs to be extra clear on this point, and provide code samples for both async and standard functions!

4 Likes