Ingo
Ingo

Reputation: 1802

Why can I not import this class?

I have three classes having to import each others methods. The statements would be as follows in the corresponding files with classes:

File A with class a

from B import b

File B with class b

from C import c

File C with class c

from A import a

Why does this not work in python? I rather get the error message:

ImportError: cannot import name a  

Upvotes: 0

Views: 93

Answers (2)

Santa
Santa

Reputation: 11547

What you have is a classic circular import problem in Python. Have you taken a look at previous questions on SO, like this one?

Upvotes: 2

user489041
user489041

Reputation: 28304

Python can't find it. Is it in the proper directory, does it actually exist?

Upvotes: 0

Related Questions