[issue41770] Import module doesn't updated

2020-09-18 Thread Terry J. Reedy
Terry J. Reedy added the comment: I carefully redid your test, corrected, 3 times, and it works as expected. Win 10, 3.9.0rc2. >>> import a.tem3 as t >>> t.b Traceback (most recent call last): File "", line 1, in t.b AttributeError: module 'a.tem3' has no attribute 'b' # Add 'b = 2'

[issue41770] Import module doesn't updated

2020-09-12 Thread chen-y0y0
chen-y0y0 added the comment: --REOPEN-- >>> # I try: >>> import xxx >>> del sys.modules['xxx'] >>> # But: Traceback (most recent call last): File "", line 1, in del sys.modules['xxx'] NameError: name 'sys' is not found >>> # I try to import sys. >>> import sys >>> del sys.modules['xxx']

[issue41770] Import module doesn't updated

2020-09-11 Thread Steven D'Aprano
Steven D'Aprano added the comment: This is not a bug, it is working as designed. Importing takes the module from the cache. You can either delete the module from the cache: del sys.modules['modulename'] import modulename # reloads from the module file or possibly simpler, use

[issue41770] Import module doesn't updated

2020-09-11 Thread pmp-p
Change by pmp-p : -- nosy: -pmpp ___ Python tracker ___ ___ Python-bugs-list mailing list Unsubscribe:

[issue41770] Import module doesn't updated

2020-09-11 Thread pmp-p
pmp-p added the comment: Hi, you just need to call del sys.modules['xxx'] and have a look at https://docs.python.org/3.7/library/importlib.html#importlib.invalidate_caches before importing again -- nosy: +pmpp ___ Python tracker

[issue41770] Import module doesn't updated

2020-09-11 Thread chen-y0y0
New submission from chen-y0y0 : # I create a module: # \sys.path\xxx.py a = 9 # And: >>> import xxx >>> xxx.a 9 # I delete this imported module and modified this module: del xxx # \sys.path\xxx.py a = 9 b = 8 # And re-import: >>> import xxx >>> xxx.b # But: Traceback (most recent call last):