python import from sibling directory
# Directory Structure
parent_dir/
foo_dir/
foo.py
bar_dir/
bar.py
# bar.py
def foobar():
print("foobar")
# foo.py
import sys
import os
sys.path.append(os.path.normpath(os.path.join(os.path.dirname(os.path.abspath(__file__)), '..', 'bar_dir')))
from bar import foobar
foobar()