I'm trying to learn how to use imports in python properly, but my linter pyright in neovim is giving me error messages despite being able to run the code. I have this structure in a python 3 test project.
directory structure
__init__.py
main.py
subdir1
__init__.py
test1.py
test2.py
the init-files are empty.
main.py
from subdir1.test2 import print_message_2
print_message_2()
test1.py
def print_message():
print(__name__)
test2.py
# this line gives linting error: "Import "subdir1.test1" could not be resolved [Pyright: reportMissingImports]"
from subdir1.test1 import print_message
def print_message_2():
print_message()
question
How do I use python imports the right way, so that the linter doesn't complain? Is it even possible to open the test2.py file and not get linting errors?