延迟导入Python模块的几种方法 - 知乎 (zhihu.com)
# __init__.py import importlib __all__ = ['complicated'] def __getattr__(name): if name in __all__: return importlib.import_module("." + name, __name__) else: raise AttributeError(f"module {__name__!r} has no attribute {name!r}") def __dir__(): return __all__
标签:__,name,Python,导入,模块,延迟 From: https://www.cnblogs.com/daizichuan/p/17781976.html