Project structure for medium and large apps FULL EXAMPLE (UI AND LOGIC SPLITTED)

My app will be running on a local server.


  • SQL connection
    Search in database, print results.
  • image/OCR-textrecognition
  • MSAL integration (Microsoft Login)
    *live camera

For a user it should not be possible to go a step back.
It should present a click through tutorial/instructions
So in background there are many pages or categories wich will be presented the user.

But in forground there is only one page. I want to split the function of the app in many py files. So one py file for Commands, each page is a function bundle with separeted py files.

Each page can execute the commands from the
Also I think I need session state, because the input data should work for more pages than one.

current structure:
src/pages/ (UI Widgets with commands from imported, start other pages)
src/pages/ (many other pages).py
src/ (widget commands for and pages) (start streamlit and home page, manage st.session_state )

So UI is separeted from Logic commands
There are differnt UI-pages but similar logic.

Has any one a full example with a more complex structure than one or two py files.

Many Thanks.

I have circular import problems.
live camera not loading

ther has to be a structure, where I can design the UI in py and the logic at another py.

Or is streamlit only able to use the logic an ui at the same file


streamlit 1.29 and python 3.11

other streamlit main components: gridlayout to mange widgets.

maybe these components: :diamond_shape_with_a_dot_inside: Grid Layout - streamlit-extras (

are not full functional.

Is threre a similar grid-layout, which i can use.
Or should i manage the widgets with columns from streamlit original???