This post and solution might be helpful
And then once you’ve read about startup modules you’ll probably want to search for that (some useful links):
Anvil Docs | Client Code
Returning to a startup module - #2 by stefano.menci