Saving Unique Data to different pages

I am building an app that has 5 pages. On the landing page of the app the user can save different projects.
I need to be able to use a unique set of the 5 pages for each project.

I have tried several approaches - but no joy - so any help would be great

Have a look on streamlit-superapp as it can handle a hierarchy of folders and/or pages.

Here is an example. Under the pages folder you can create folders.

Under Projects we have 3 subprojects.

Under South Pacific Project we have 3 pages (you can create more).

Going back to pages’s folder cards we have Create Project card, inside that you can have:

Your typical code here will be:

import os
import streamlit as st
from streamlit import session_state as ss


NAME = "Create Project"
DESCRIPTION = "Creates project"
ICON = "🐥"


def create_project_cb():
    path = os.path.join('./pages/project', ss.project_name) 
    os.mkdir(path)

    with open(f'{path}/__init__.py', 'w') as f:
        f.write(f'''import streamlit as st

                
NAME = "{ss.project_name}"
DESCRIPTION = "{ss.project_desc}"

def main():
    st.write(f"Welcome to {ss.project_name}'s Page")
'''
) 


def main():
    with st.form('form'):
        st.text_input('Project Name', key='project_name')
        st.text_input('Project Description', key='project_desc')
        st.form_submit_button('Create Project', on_click=create_project_cb)

VS code explorer would look something like this.

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.