Python ctypes: loading DLL from from a relative path January 5, 2024 by Tarik You can use os.path.dirname(__file__) to get the directory where the Python source file is located.