Stream: beginners

Topic: Module Aliasing


view this post on Zulip Luke Boswell (Dec 08 2023 at 19:33):

Is it possible to alias imported modules?

Say for example I have imported the package html.Attributes, I would love to be able to do html.Attributes as A. The issue is that I like using qualified names instead of having to import everything, but writing Attributes. as a prefix everywhere is a lot of code pollution.

I skimmed back through module params proposal and Im not sure if this is covered. It looks like we can alias the package itself but maybe not the modules within that package?

view this post on Zulip Agus Zubiaga (Dec 08 2023 at 21:22):

Yes, this is not currently possible, but it will be supported by the new imports

view this post on Zulip Agus Zubiaga (Dec 08 2023 at 21:24):

It will look like:

import html.Attributes as A

Last updated: Jul 05 2025 at 12:14 UTC