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?
Yes, this is not currently possible, but it will be supported by the new imports
It will look like:
import html.Attributes as A
Last updated: Jul 05 2025 at 12:14 UTC