I'm trying to import a file from a different directory, I've tried some of suggestions but none seemed to work for me.
In particular sys.path.insert(...) would not work for me, because I will not have constant absolute path to the file.
I have the following structure where my python files live:
project/packages/package_type/package/package_name/root/usr/bin/
So I need to import
project/packages/package_type/foo/root/usr/bin/foo
(file does not have .py extension, but is a python file)
from
project/packages/package_type/bar/root/usr/share/bar/modules/foobar/bar.py
The folder with the file I need to import has an empty __init__.py
file
I also tried
import package-type.foo.root.usr.bin.foo as foo
I am not sure how it's intended to use, since it is intended for Arch Linux package, and the files will simply be exported to /usr/bin