I had a similar issue with page routing. Not sure if it will help but I had to chain the if statements together with elif. In fact, I ended up using match case available in the latest version of python. See image below
if page.route == create.route:
page.views.append(create)
elif page.route == login.route:
page.views.append(login)
elif page.route == reset_password.route:
page.views.append(reset_password)
elif page.route == update_password.route:
page.views.append(update_password)
elif page.route == main_view.route:
page.views.append(main_view)