相对模块在玛雅人使用Python进口
我的默认设备Maya脚本文件夹中有一个软件包文件夹。例如(c:\ users \ username \ documents \ maya \ 2020 \ scripts \ packagefolder)。
该软件包基本上是这样的:
package/
__init__.py
Classes/
ExampleClass.py
__init__.py
Utils/
SomeUtilModule.py
__init__.py
在我的 init .py文件中,我尝试导入这样的模块:
from package.Classes import ExampleClass
Maya说什么:
# Error: ImportError: file C:/Users/USERNAME/Documents/maya/2020/scripts\package\__init__.py line 5: No module named Classes #
我在这里做错了什么?
I have a package folder located in my defaults maya scripts folder. E.g. (C:\Users\USERNAME\Documents\maya\2020\scripts\packageFolder).
The package is basically structured like so:
package/
__init__.py
Classes/
ExampleClass.py
__init__.py
Utils/
SomeUtilModule.py
__init__.py
In my init.py file I try to import modules like so:
from package.Classes import ExampleClass
what Maya says:
# Error: ImportError: file C:/Users/USERNAME/Documents/maya/2020/scripts\package\__init__.py line 5: No module named Classes #
What am I doing wrong here?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我怀疑这与Maya的实施无关,而是关于您的Python代码中的循环进口。可能,您的审查计划'
__ init __. py
从软件包导入。您可以通过搜索“ Python循环进口”来阅读有关此内容的信息。不幸的是,错误描述不会显示问题的性质,如果您不知道事先的原因,就会非常困惑。
关于如何处理此问题有很多建议,仅举几例:一个< /a>,两个。
I suspect it's not about Maya's implementation, it's about circular imports in your Python code. Probably, your ExampleClass'
__init__.py
imports from package.You can read about this by searching for "Python circular imports". Unfortunately, the error description does not show the nature of the problem and is very confusing if you don't know the reason beforehand.
There are plenty of suggestions on how to deal with this, just to name a few: one, two.