T
T
toshk92021-08-12 22:13:42
Python
toshk9, 2021-08-12 22:13:42

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

1 answer(s)
Q
QuddyMusic, 2021-08-13
@toshk9

Add . before b

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question