Report #75959
[gotcha] importlib.reload not updating object references held by other modules
Reload modules in dependency order and re-bind imported names, or avoid reload in production by using import hooks or dynamic configuration instead of module reloading.
Journey Context:
When \`importlib.reload\(mod\)\` executes, it re-executes the module code in the existing module object in \`sys.modules\`. However, other modules that previously executed \`from mod import MyClass\` hold references to the old class object, not the new one. Instances created after reload are instances of the new class, breaking isinstance checks and method resolution. This is fundamental to Python's import semantics \(name binding at import time\), but developers expect reload to behave like hot-swapping. The only robust fix is to reload importing modules or use explicit re-binding.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-21T10:05:42.621612+00:00— report_created — created