How to run code for every page in a multi-page app

I’d like to run some code at the end of every page in my multi-page app. For the sake of example, let’s say I want to add a footer to every page via some custom HTML and st.html(); is there a nice way to do that in one place, or would I need to add that code to every page?

One can place the shared code in a module, and use that module in each page.

I did this in GitHub - jokester/streamlit-concurrency: Easier and safer concurrency for Streamlit (the repo itself is a demo app for the library)

@jokester thanks! Do you mean your use of demo? Or something else? I was thinking ideally I could have some wrapper around st.Page - e.g. stCustomPage - that would render the page and then add something at the bottom.

Yes I wanted to show the use of demo

Cool yeah demo.render_page_src(__file__) is close to what I had in mind although I was hoping to not have to put any code in the page module itself and deal with it on the main page (in your example, I believe that would be streamlit-concurrency.py