PlasmaCalcs.tools.imports.reload

PlasmaCalcs.tools.imports.reload(package='PlasmaCalcs', *, return_affected=False, maintain_defaults=True)
reloads the provided package.
Similar to enable_reload(package); import package.
maintain_defaults: bool, default True
if True, update DEFAULTS in the reloaded package with any DEFAULTS set before reloading.
Does nothing if the original package does not have a ‘DEFAULTS’ attribute.
e.g. pc.reload() stores defaults0=pc.DEFAULTS, then reloads, then pc.DEFAULTS.update(defaults0).
returns the reloaded package.
if return_affected also return a list of all affected package names.

NOTE: this reloads package but doesn’t do it “in-place” (i.e. doesn’t change the package variable). | For example: | import PlasmaCalcs as pc | import mypackage as myp0 | myp1 = pc.reload(myp0) | myp1 is myp0 –> False, because myp0 points to the pre-reload version of the package.

Thus, to use this method, you should instead assign the package to the result, for example:
import PlasmaCalcs as pc
pc = pc.reload()
# or, to reload a different package
import mypackage as myp
myp = pc.reload(myp)
package: str or module
the package to reload. if module, use package.__name__.