0

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?

Marten Zander
  • 2,385
  • 3
  • 17
  • 32

1 Answers1

0

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.

ababak
  • 1,685
  • 1
  • 11
  • 23