Module variables do not seem to be re-evaluated with autoreload
- Dominant language
- Python
- Stars
- 16.8k
- Forks
- 4.5k
- Avg merge
- 1d 2h
- Merged PRs (30d)
- 6
Description
Test case:
```python
#----------------------------------------------------
# foo/__init__.py
# blank
#----------------------------------------------------
# foo/bar.py
def say_hello():
return "hello"
def say_goodbye():
return "goodbye"
#----------------------------------------------------
# foo/baz.py
from .bar import say_hello, say_goodbye
_full = say_hello() + " and " + say_goodbye()
def say_all():
return _full
#----------------------------------------------------
# notebook.ipynb
%load_ext autoreload
%autoreload 2
from foo.baz import say_all
print(say_all())
```
If you change `say_hello` to return `hola` in `bar.py` after importing, the value of `_full` is never re-evaluated, so subsequent calls to `say_all` do not reflect the new value.
Contributor guide
Assessment
This issue has not been assessed yet.