Skip to content
Prev Previous commit
Next Next commit
Update reload documentation
  • Loading branch information
QEDady committed Nov 27, 2025
commit 9d2750289dd26e1a3bfb1eb1dd7d62b0bdd5f07b
6 changes: 6 additions & 0 deletions Doc/library/importlib.rst
Original file line number Diff line number Diff line change
Expand Up @@ -210,6 +210,12 @@ Functions
:exc:`ModuleNotFoundError` is raised when the module being reloaded lacks
a :class:`~importlib.machinery.ModuleSpec`.

.. versionchanged:: 3.14
Comment thread
brettcannon marked this conversation as resolved.
If *module* is a lazy module that has not yet been materialized (i.e.,
loaded via :class:`importlib.util.LazyLoader` and not yet accessed),
calling :func:`reload` is a no-op and returns the module unchanged.
This prevents the reload from unintentionally triggering the lazy load.

.. warning::
This function is not thread-safe. Calling it from multiple threads can result
in unexpected behavior. It's recommended to use the :class:`threading.Lock`
Expand Down
Loading