I have just created my first
app.py for Streamlit. However, the lines of code are growing fast, as I am creating a lot of different sections with information.
I want to split the contents of
app.py into subfiles.
I tried using
exec(open("./subfile.py").read()), which works, but my understanding is that this is bad practice. (NB: I’m not importing any external code in the subfiles, only creating some variables and referencing some external iframe URLs via
Furthermore, Streamlit doesn’t detect changes in
subfile.py so you aren’t prompted to Rerun or Always Rerun the code upon editing it.
How should I split my project into multiple files, and can it be made to work with Always Rerun?