Hide pages in Multiple pages app

I have developed a Streamlit app with multiple pages using the sidebar. My objective is to implement a mechanism where clicking on one page in the sidebar will hide the other pages. I’m seeking guidance on how to achieve this behavior effectively. Could you please provide assistance or suggestions for implementing this functionality?

I’ve created a Streamlit app with multiple pages, but currently, when I click on one page, the sidebar persists on other pages. I want to modify this behavior so that clicking on one page hides the sidebar on other pages.

def run():
    with st.sidebar:
        app = option_menu(
            menu_title="pondering",
            options=['Account','Trending','Your Posts','About'],
                    default_index=1)
    if app == 'Account':
        account.app()
    if app == 'home':
        home.app()
    if app == 'Trending':
        trending.app()
    if app == 'Your Posts':
        your_posts.app()
    if app == 'About':
        about.app()
        run()