User info and login

This is a classic - you are opening another form before the current form has loaded, instead move it to the form show event:

class Form_main(Form_mainTemplate):
  def __init__(self, **properties):
    # Set Form properties and Data Bindings.
    self.init_components(**properties)
    self.content_panel.add_component(Form_main_central())
    # Any code you write here will run when the form opens.

  def form_show(self, **event_args):
    anvil.users.login_with_form(allow_cancel=True)
    loged = anvil.users.get_user()
    self.link_user.text = loged 
    if not loged: 
      open_form('Form_website') #I can't be in an init method

A better approach would be to create a startup module, see this post for a typical approach to checking a user on startup and determining which form to load:

2 Likes