python imports

python imports are weird in the sense that you can't just do import "../../".

Depending on your file structure, things can get a bit complicated. Here's my fix.

(based on this

file structure:

└── Application/
|   ├──
|   └── Module/
|       ├──
|       └──
└── Tests/

In this scenario, Tests is my unit test directory and I want to import

Application directory is the parent of the project so we need to add it to sys.path for python to be able to find it.

import sys
sys.path.insert(0, os.path.join('Project_Parent', 'Application'))
from Module.moduleA import function_in_moduleA

Got comments or issues with what I wrote? Please let me know by submitting an issue with the blog title :)