def module_path():
    encoding = sys.getfilesystemencoding()
if we_are_frozen():
    return os.path.dirname(str(sys.executable, encoding))
return os.path.dirname(str(__file__, encoding))
How do I get the path of the current executed file in Python?