autoreload kills variables
- Langage dominant
- Python
- Étoiles
- 16.8k
- Forks
- 4.5k
- Merge moyen
- 1 j 2 h
- PR mergées (30 j)
- 6
Description
[As recommended](https://ipython.readthedocs.io/en/stable/config/extensions/autoreload.html) I added
```
%load_ext autoreload
%autoreload 2
```
to my notebook and now, indeed, the modules are automatically reloaded.
Alas, I have
```
try: # https://docs.python.org/library/importlib.html
rala_all # reload will not reset rala_all
except NameError:
rala_all = {}
```
in my module. It did work before using [`importlib`](https://docs.python.org/library/importlib.html), but, with [`autoreload`](https://ipython.readthedocs.io/en/stable/config/extensions/autoreload.html) I see `rala_all` being reset (to an empty dictionary) every time the module is reloaded.
Is there a way to avoid this? I want `rala_all` to survive (auto)reload.
(also [asked](https://stackoverflow.com/q/62204805/850781)).
Guide de contribution
Ouvrir le guide de contribution
Évaluation
Cette issue n'a pas encore été évaluée.