0

I have some python codes like this structure:

> project_folde
|
|----a.py
|----b.py
|_____________folder
              |
              |----__init__.py
              |----c.py (func1)
              |----d.py (func2, funct3)

In a.py, I use several functions that are defined in c.py. I import those functions like from folder.c import func_1.

In c.py, I use functions that are in d.py. I import them in this manner: from d import funct2, func3. It seems this kind of importing in a subfolder is wrong because I get this error: from d import ModuleNotFoundError: No module named 'd'.

How can I fix the problem?

Probably something like from folder.d import funct2, func3 will work. Can we solve the problem without modifying the code?

CVDE
  • 393
  • 3
  • 19

0 Answers0