Sure this is what I use
# run_app.py
import streamlit.runtime.scriptrunner.magic_funcs # Force cx_Freeze to bundle this :contentReference[oaicite:1]{index=1}
import streamlit.web.cli as stcli # Also ensure web.cli is included :contentReference[oaicite:2]{index=2}
#Place all imports your script has
import openai
import sys
from openai import OpenAI
import os
import re
from bs4 import BeautifulSoup
import requests
import fitz # PyMuPDF
import sys
#End imports here
def main():
sys.argv = ["streamlit", "run", "app.py", "--global.developmentMode=false"]
sys.exit(stcli.main())
if __name__ == "__main__":
main()
I put every import I have from the top of my scripts even simple things like requests or sys
If I don’t change imports I can keep using the same EXE just changing oout app.py’s code