首先创建一个模块目录lib,然后在目录内创建一个模块为:aa.py
官方推荐:
import importlib aa = importlib.import_module('lib.aa') c = aa.c() print(c)
__import__导入方式
lib = __import__('lib.aa') # 相当于import libc = lib.aa.c()print(c)