1.主程式如下 ,app.py
import app1
import app2
import streamlit as st
PAGES = {"範例一": app1,"範例二": app2}
st.sidebar.title('Navigation')
selection = st.sidebar.radio("Go to", list(PAGES.keys()))
page = PAGES[selection]
page.app()
2.產生另外兩個 py檔案 app1, app2
import streamlit as st
def app():
st.title('APP1')
st.write('Welcome to app1')
import streamlit as st
def app():
st.title(‘APP2’)
st.write(‘Welcome to app2’)