if __name__ == '__main__' and __package__ is None:
    from os import sys, path
sys.path.append(path.dirname(path.dirname(path.abspath(__file__))))
How to fix "Attempted relative import in non-package" even with __init__.py