Why does Streamlit crash or momentarily hang when importing a module in a multipage app?

I’m deploying an app on AWS EKS using the Streamlit Operator framework.

Just about everything works fine except importing my own modules.

my folder structure is /streamlit/main.py. I also have a init.py file in this folder. The modules are in /streamlit/data/, which also has an init.py file.

When i import something like this “from data.module import func”, the connection to the app will temporarily sever (see below) and then pick back up. When i import several modules consecutively, it may sometimes crash (502 error).

image

Is there a better way to import modules on a cloud deployment (EKS specifically)?

I never used AWS EKS, but did you tried to change the name “data” by “my_data” ?
Sometimes this kind of namespace is a reserved keyword.
Have a nice day
jp

i ended up appending the folder of the modules to the path and importing directly like from module import func

still see the connecting message but it doesn’t seem to last as long now.