pycharm打包exe执行代码中__import__和getattr反射动态加载,报ModuleNotFoundError错误

动态加载另一目录下py脚本中的方法,pycharm窗口直接运行可以,打包exe运行报ModuleNotFoundError错误
web_func_path = 'web.' + web_py
web_func_dir = import(web_func_path)

错误:
Traceback (most recent call last):
File "manager_new.py", line 183, in
run_app()
File "manager_new.py", line 178, in run_app
testDemo(driver, report_file, report_sheet_name, data)
File "manager_new.py", line 83, in testDemo
execute_result = get_result_from_web(driver, web_py, web_func, web_args)
File "src\manager_get_result.py", line 18, in get_result_from_web
web_func_dir = import(web_func_path, fromlist=True)
ModuleNotFoundError: No module named 'web'

有解决办法没?,谢谢

你用什么打包的,是pyinstaller么,明显就是模块没有打包,反射的依赖关系找不到,需要手工打进去