I am looking for a easy way to import functions from another folder:
|--mylib
|   |--__init__.py
|   |--mylib2.py
|
|--mytest
|   |--other.py
|   |--test_one.py
|
|--mymain.py
mylib2.py
def suma(a,b):
    return a+b
mymain.py
from mylib.mylib2 import suma
def main():
    a=3
    b=4
    c=suma(a,b)
    print(c)
if __name__ == "__main__":
    main()
other.py
from mylib.mylib2 import suma
c=suma(1,2)
print(c)
test_one.py
from mylib.mylib2 import suma
def test_nothing():
    assert True
def test_crash():
    e=0
    #d=30/e
    assert True
For some reason I can not call suma from other.py normally (because I don't know how to properly include mylib2.py in a file from mytest folder but following this answer I could do
python3 -m mytest.other
3
The problem is that I don't how to run the pytest including the library
if I do pytest I got a message
    from mylib.mylib2 import suma
E   ModuleNotFoundError: No module named 'mylib'
How can I run the test in a simple way?
 
    