import os


def setting(name):
    return name.upper()

def path(subpath):
    import __main__
    project_root = os.path.dirname(os.path.realpath(__main__.__file__))
    return os.path.join(project_root, subpath)


import os


def setting(name):
    return name.upper()

def path(subpath):
    project_root = os.path.dirname(os.path.realpath(__file__))
    return os.path.join(project_root, subpath)


--- 
+++ 
@@ -5,6 +5,7 @@
     return name.upper()
 
 def path(subpath):
-    project_root = os.path.dirname(os.path.realpath(__file__))
+    import __main__
+    project_root = os.path.dirname(os.path.realpath(__main__.__file__))
     return os.path.join(project_root, subpath)
 
Fix 'path' function: use main's file as project root
