ecolab.clear_cached_modules

ecolab.clear_cached_modules#

etils.ecolab.clear_cached_modules(modules: str | collections.abc.Sequence[str], *, recursive: bool = True, verbose: bool = False, invalidate: bool = True) None[source]#

Clear the sys.modules cache.

Helpful for interactive development to reload from Jupyter notebook the code we’re currently editing (without having to restart the notebook kernel).

Usage:

ecolab.clear_cached_modules(['visu3d', 'other_module.submodule'])

import visu3d
import other_module.submodule
Parameters:
  • modules – List of modules to clear

  • recursive – Whether submodules are cleared too

  • verbose – Whether to display the list of modules cleared.

  • invalidate – If True (default), the instances of the module will raise an error when used (to avoid using 2 versions of a module at the same time)