Brett Cannon added the comment: Because stat results are cached for performance reasons, it's possible to write to the file system and then try to read/import from it before the modification time for the directory even picks up that there was a change. For this reason there is importlib.invalidate_caches(): https://docs.python.org/3/library/importlib.html#importlib.invalidate_caches .
I have opened http://bugs.python.org/issue23422 to track that the docs for importlib.import_module() point out invalidate_caches(). ---------- resolution: -> not a bug status: open -> closed _______________________________________ Python tracker <rep...@bugs.python.org> <http://bugs.python.org/issue23412> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com