Multi-page App from Single Apps

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.

Thanks,

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.

Thanks for the help,

Hey @pontificating_panda,

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?

1 Like

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.

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