[英]Cannot find reference 'ref_name' in __init__.py [on hold]
I'm trying to make my own simple snake AI from this repository.我正在尝试从这个存储库中制作我自己的简单蛇 AI。 And I have such problem: my IDE underlines我有这样的问题:我的 IDE 下划线
from api import ping_response, start_response, move_response, end_response
saying that it cannot find reference ping_response
, start_response
etc in __init__.py
.说它在__init__.py
中找不到引用ping_response
、 start_response
等。 But those functions are defined in api.py
.但是这些函数在api.py
中定义。 And as far as I'm concerned they are imported from api
.就我而言,它们是从api
进口的。 Any help?有什么帮助吗?
change改变
from api import ping_response, start_response, move_response,
to至
from app.api import ping_response, start_response, move_response,
and call your script from the top level directory with并从顶级目录调用您的脚本
python -m app.main
This should work.这应该有效。
You can also restructure your directories otherwise, but my suggestion could be a start您也可以以其他方式重组您的目录,但我的建议可能是一个开始
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.