Returning to main page for multipage app

I have a local app with multipages and am trying to add authentication to it. If I am logged in, these are the pages I used using st_pages

        if user:
            st.success("Logged In Sucessfully {}".format(email))
            st.session_state.authentication_status = True

                    Page("pages/", "generate", icon="๐Ÿ“"),
                    Page("pages/", "logout", icon="๐Ÿšช"),
                    Page("", ""),

Notice my main page must be added or else switch_page("") doesnโ€™t work.

I made a logout page since this is the only way I found to create a โ€œbuttonโ€ on the sidebar along with other pages (as opposed to st.sidebar which did not work for me). The logout page looks like this

import streamlit as st
from streamlit_extras.switch_page_button import (
)  # import the switch_page function
from components.authenticate import supabase_client
from time import sleep
from st_pages import hide_pages

# Logout page
def logout():
    if not st.session_state.authentication_status:"Please Login from the Home page and try again.")
    st.session_state.authentication_status = False  # set the logged_in state to False
    res = supabase_client.auth.sign_out()
    if res:
        st.error(f"Error logging out: {res}")
        st.success("Logged out successfully")
        switch_page("")  # switch back to the login page

def main():
    if st.session_state.authentication_status:

if __name__ == "__main__":

Here switch_page should direct user to the main page route (/) after logging out - it does, but the route gets stuck at /logout. When logging back in, the error pops up

Page not found The page that you have requested does not seem to exist. Running the app's main page.

Ideally I just want to return to main page without having to show_page([..., Page("", "")]) and subsequently having to use switch_page("") which only works if exists in the page lists.

Without a minimal example of this, does anyone have any experience / advise on this?

Hey @hud! :wave:

Weโ€™re not supporting Python 3.12 yet. Weโ€™ll work on it soon but are currently blocked by pyarrow not supporting 3.12 yet. According to this issue, they will work on it in the next few weeks though.

I hope this helps.


looking forward for the support. Canโ€™t wait to build a streamlit app with python3.12 โ€ฆ

This is a bit confusing. The OP doesnโ€™t seem to be specifically related to python 3.12.

pyarrow 14 was released more than two weeks ago and I have been using streamlit with python 3.12 without issues. There is not explicit support for it, though. But it works as far as I can tell

Sorry for the delay. Yes this error has nothing to do with 3.12 I am using 3.9. The question really was about returning to main app page using st_pages. Any ideas how to do this?