This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author epaine
Recipients KevKeating, brett.cannon, epaine, eric.snow, ncoghlan
Date 2020-11-10.19:02:02
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1605034923.56.0.0971596755176.issue42273@roundup.psfhosted.org>
In-reply-to
Content
In short, the module isn't being added to the package's namespace because we are directly modifying sys.modules (hence why the behaviour would be the same if we imported using `import foo.b` as `from foo import b`).

I personally prefer to use the metapath instead of modifying sys.modules but I agree that the given example should work when the lazy import is not in `__init__.py`. The other solution is to modify the `LazyLoader` class to explicitly add the lazy module to the package's namespace (opinions?).
History
Date User Action Args
2020-11-10 19:02:03epainesetrecipients: + epaine, brett.cannon, ncoghlan, eric.snow, KevKeating
2020-11-10 19:02:03epainesetmessageid: <1605034923.56.0.0971596755176.issue42273@roundup.psfhosted.org>
2020-11-10 19:02:03epainelinkissue42273 messages
2020-11-10 19:02:02epainecreate