I have two files, a.py and b.py. They are different branches of the same project (I checkout another branch in a separate directory with git). I have a third file c.py, that imports functions from both a.py and b.py to compare against each other.
My issue is a.py and b.py have nearly identical imports, but the content of what they're importing is often different because they are different branches. When I import the functions to be tested from each file (a.py and b.py) into c.py I need to add their paths to sys.path. When I do this b.py imports the same modules as a.py, rather than importing it's own or vice versa.
At the moment, I've just been adding an extra "directory" to the imports each time I make a new branch. So if I had import x, y, z originally in b.py (the non-master branch), I would add the path before the directory with those modules to sys.path and change the imports to branch_a.x as x, branch_a.y as y, branch_a.z as z... It doesn't take very long, but it would be nice to have an automated solution. Any ideas?
EDIT: Code for relative paths:
import sys
sys.path.append("./..")