Ask the question of introducing the module into python

The code structure of the

project is as follows: main.py is the main program, and the method in file01.py under module is introduced, but because the method in file02.py is also introduced in file01.py, the method of file02.py will not be found during the execution of main.py. Please ask the expert how to solve it.

src
    -main.py
    module
        -file01.py
        -file02.py
        -__init__.py
Mar.22,2021

there is an error in the method introduced into file02 in your file01.py . It is not that main.py cannot find the method in file02.py , but that 01 cannot find the method in 02.
< del >
sibling relative references can be considered < / del >

.
 

thanks to the answer upstairs, I didn't make myself clear. After file01.py introduced the file02.py method, there is no problem for file01.py to call file02.py as a function entry, but if main.py introduces the file01.py method in the upper directory, it will inevitably fail to find the module in file02.py. This is caused by the introduction of specification by python3 to package
my method is:

form in file01.py. Import file02

from module import file01

in main.py

the concept here is still vague, and we need to learn more. Thanks again for the answer upstairs.

Menu