[英]Module Not Found Error for Directory after importing python model in Rasa Chatbot
So I tried a majority of the solutions on this platform and none of it worked.所以我尝试了这个平台上的大部分解决方案,但都没有用。 Im desperately in need of help.
我迫切需要帮助。
I'm using Rasa Chatbot in my project and im trying to use actions.我在我的项目中使用 Rasa Chatbot,我正在尝试使用操作。 In actions im trying to call a getAllProducts function from the negotiate.py python file in my backend directory.
在操作中,我试图从后端目录中的 negotiate.py python 文件调用 getAllProducts function。 My project file structure looks like this.
我的项目文件结构如下所示。
and I import the function like this in actions.py我在 actions.py 中像这样导入 function
Ill be calling the function as follows我将按如下方式拨打 function
but im getting the following error when I try to execute this in rasa,但是当我尝试在 rasa 中执行此操作时出现以下错误,
How can I fix this error?我该如何解决这个错误?
You can go back in an import only inside a module with the __init__
file.您可以 go 仅在具有
__init__
文件的模块内导入。 If you want to do import negotiate as nego you must put the file negotiate.py inside the action directory of rasa chatbot.如果你想将 import negotiate as nego 导入,你必须将文件 negotiate.py 放在 rasa chatbot 的 action 目录中。 If you don't want to do it, you must use
如果你不想这样做,你必须使用
import os
import sys; sys.path.insert(1, os.path.join(sys.path[0], '../..'))
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.