这听起来很荒谬,因为这个网站上对这个问题的回答似乎是无限的-但是如果不临时更改每次重新加载的系统路径(或init,这对我的设置不起作用),我找不到一个简单的解决方案。我在找一个安全的,非黑客的方法来完成这个。在
简单地说-我有如下目录结构:
**root**
>main.py
>**modules**
>>rivescript.py
>>js.py
>**plugins**
>>weather.py
>>synd.py
为了简单起见,我想将每个可用的模块以本机方式导入到所呈现的子目录(模块、插件)中主.py在
伪码:
^{pr2}$并能够调用函数,例如:
plugins_weather.get("3088")
modules_rivescript.RiveScript.reply("localuser", language_input)
有什么建议吗?速度和资源消耗对这个项目来说是一件大事。在
首先,您应该将u init_uu.py文件(可能是空的)放在modules/和plugins/目录中,将它们标记为包。在
现在,您可以在中导入模块了主.py公司名称:
相关问题 更多 >
编程相关推荐