I'm new to Python and I searched google a lot and read some articles about relative imports etc. Despite the fact that I am unable to get it working. Please, consider my following project structure:
/Project /docs /log /prev /src a.py /tests /tests1 b.py /tests2 .gitignore README.txt program.py And what I'm trying to achieve is to import a class from file a.py inside of the script b.py. Generally speaking, script b.py should have line with import of a.py. I've read some articles about using __init__.py files, where should I put them? And should I change PYTHONPATH some way, how? And last question, is project structure OK? Thank you for your time and help!
setup.pyand install your package for import by the tests. The/testsdirectory itself isn't usually a module (so no__init__.py) - see pytest.org/latest/goodpractises.html#goodpractises