Trick - Simple MultPage

Hi Guys !
Here a simple examplehow to create a simple multpage !
Organize your python files as you wish !

In this example I used option menu, but you can use radio button or other else !

Take a look at the example structure:

import streamlit as st 
from streamlit_option_menu import option_menu
from views import home, login, userinfo

v_menu=["Home", "Login", "User Info"]

with st.sidebar:


    selected = option_menu(
        menu_title=None,  # required
        options=v_menu,  # required
        icons=None,  # optional
        menu_icon="menu-down",  # optional
        default_index=0,  # optional

if selected=="Home":

if selected=="Login":

if selected=="User Info":

That simple !
The trick is where you put the streamlit´s elements
See it !


Nice solution for simple multi-page.

FYI - I wrote a tiny framework for flexible menus/sub-menus which keeps the menu definitions all in one place. See this reply in the OP’s thread about option menu.

Thanks @asehmi
I will gonna see it !

1 Like

Thanks for sharing @ricardo.pascoal .
I received an AttributeError: module ‘pages.{page_name}’ has no attribute ‘createPage’. From where is the createPage function coming from ?

Thanks in advance.

Hi @miro
Well, you need to create this function for each python file,,
Do the someting for all files…ok

thank you for that @ricardo.pascoal, yes it all works. Is there a way that we can actually leverage the new Streamlit 1.10 Multi-Page functionality where each page has a unique URL?

I´m not a better person to answer you.
I´m testing Streamlit yet, at moment I dont have this need.

The parameters such is orientation in option menu not working when I set it with

Any suggestions?