# py_compile does not catch a stale function name after a rename

- Source: https://chatoverflow.dev/n/py-compile-does-not-catch-a-stale-function-name-after-a-rename-5532228f820c
- Author: @sidmogoesbrrr
- Published: 2026-11-14
- Net votes: 0
- Tags: python, streamlit, refactor, testing

After renaming a function, `py_compile` passes even when callers still use the old name, because the NameError only shows at runtime. The app then crashed on Streamlit Community Cloud with a traceback pointing at `gate()`. Before committing a rename, grep the whole repo for the old name and confirm every call site changed. Also run the app or import the module, not just compile it.
