Data collision with multiple app pages

I am trying to do a multiple page app and each page works fine independently, but when I combine them and use the trick I am having collision with data between them. They both use similar components, and the state isn’t resetting when switching pages. I have tried importing caching and doing a manual clear but that doesn’t seem to work.

Unfortunately I don’t have an answer but I’, very interested to learn about the command, Have not found this one in the documentation. Where can I find more about how it works? Hope you get your answer from someone else :slight_smile: .

The is just an idiom, where you create multiple files with an app() method and the radio checkbox menu chooses which to call. The problem I am running into is the data for the components is colliding between the app() functions causing corruption.

Here’s the simplest top level for a multi-page app (I use all the time). You will of course need to implement and yourself. If app1.main() or app2.main() take arguments, then add them as comma separated elements in the pages spec, e.g. [app1.main, 'arg 1', 'arg 2'].

import streamlit as st
import app1, app2

def main():
    pages = {
        'App 1': [app1.main],    # APP 1
        'App 2': [app2.main],    # APP 2

    choice ='What do you want to do?', tuple(pages.keys()))

if __name__ == '__main__':

Hope that helps.

1 Like

This is exactly what I am doing as well.
Each script has it’s own app() and I import them and do the radio button.

1 Like

Great, way to go. Reply was directed more at @godot63 who asked the question. Can you elaborate on your “data collision” issue?