This was triggered from a separate thread with @arnaud but thought I’d set up a new topic. I didn’t find a similar question when search, but please point me to a different thread if this has been asked.
The question is what the correct way, if it can be done, is too create a multi-page app that references a single page app.
Use case is in a business where one creates a useful single page app as a module. Using a finance example say we create a “market returns dashboard” where all the data is self contained - or rather sourced from Snowflake.
It’s useful in isolation but actually we now want it as one page in a multi-page weekly team meeting app, as a page on the quarterly board meeting dashboard-app and on an app for management intelligence.
Currently, I think we would need to copy the market_returns.py file to each new dashboard. Which is easy enough to do, just by putting it in the pages/ directory but is there a way we can have the “team meeting”, “board meeting” and “MI” apps all just point to the original. Which would also reduce the risk of errors when the original is updated.
That sounds to me like good old imports. You can import market_returns from any application and then call, say market_returns.show_dashboard() from there. Am I missing anything?
@Goyo perhaps I wasn’t clear in the example. The point would be that team_meeting, board_meeting and MI are all separate apps in their own repos. So rather than have a file called market_returns.py in each repo we would reference a link, or a link to a repo or something.
That way, if we scaled the market returns app could be a page in dozens of other apps and also if one edits the market returns app (maybe adding some new markets) all the sub apps access it dynamically rather than having to update each app independently.
Perhaps you can have a look at git submodules? If your various app repos were submodules of the aggregator app repo, maybe you could then import the code as @Goyo suggeted?
I don’t think we have built-in support for exactly what you are trying to do.
It may cause problems but another hacky way to do it besides imports would be to embed the single page app in an iframe within a page of the multi page app.
But I think I would use the imports approach if I was trying to build this myself.
Some kind of “app of apps directory” or “app portal” is interesting which kind of sounds like what you want where it pulls from standalone apps. But I think it depends on how the apps are deployed and the specific context, so I’m not sure we would do a general solution for this within streamlit itself.
Thanks for stopping by! We use cookies to help us understand how you interact with our website.
By clicking “Accept all”, you consent to our use of cookies. For more information, please see our privacy policy.
Cookie settings
Strictly necessary cookies
These cookies are necessary for the website to function and cannot be switched off. They are usually only set in response to actions made by you which amount to a request for services, such as setting your privacy preferences, logging in or filling in forms.
Performance cookies
These cookies allow us to count visits and traffic sources so we can measure and improve the performance of our site. They help us understand how visitors move around the site and which pages are most frequently visited.
Functional cookies
These cookies are used to record your choices and settings, maintain your preferences over time and recognize you when you return to our website. These cookies help us to personalize our content for you and remember your preferences.
Targeting cookies
These cookies may be deployed to our site by our advertising partners to build a profile of your interest and provide you with content that is relevant to you, including showing you relevant ads on other websites.