我在PyCharm有一个项目。有一个“main”-script可以导入其他几个脚本。 5个进口中有4个进入正常,但由于某种原因,第5个和最后一个进口产生和未解决的参考。见第10行。
我认为它必须与名为“VAR5_speedlimit”的文件夹上没有蓝点有关,但我无法弄清楚它的含义。
有谁知道为什么第10行产生“未解决的参考”?
答案 0 :(得分:2)
Note the little green dot in your other "folders" but missing in the VAR5_speedlimit
folder. The ones with little green/blue dot is Python Package, the one without is Directory. You import from Python Package, not Directory.
To solve it, make a Python Package instead of Directory. Right click on your project, choose Python Package.
Alternatively, in the existing Directory, create __init__.py
in the directory