Answer the question
In order to leave comments, you need to log in
How to make an import in Python?
There are three py files: the main.py file, which is in dir_1, the a.py file, and the b.py file, which are in dir_2, which in turn is in dir_1.
The file a.py imports b.py and main.py imports a.py.
And when main.py is activated, the error 'ModuleNotFoundError: No module named “b” ' is thrown. Is there any way to fix this error. Or you need to change the structure of the files.
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question