Maybe another answer is to look at startup modules rather than startup forms
See docs on when your app starts
You can define a startup module with the following code:
import anvil.users
from anvil import open_form
def startup():
if anvil.users.get_user() is not None:
open_form("Dashboard")
else:
open_form("Login")
if __name__ == "__main__":
startup()