将许多 python 个文件从单独的文件夹导入到另一个 python 文件中

Importing many python files from a seperate folder into a single other python file

包含关卡的文件夹

进口线

如第二张图所示,为了导入'level_one',python要我创建自己的导入行, 我尝试导入两个级别:level_one 和 level_two,使用 * 符号,这就是导入库中所有方法的方法(我相信这就是它的工作原理) 但这是行不通的。下图显示我试图调出我在 'level_two.py' 文件中编写的字典,但我需要另一个导入语句才能使其工作。

文件调用位置

非常感谢

您似乎缺少 __init__.py 文件。 You need one in the directory to make python treat the folder as a package.