def find_file()

in pybulletX/helper.py [0:0]


def find_file(file_path):
    if os.path.isfile(file_path):
        return file_path

    # if file_path is relative path, then we will go through pybulletX.path,
    # see if file is in any directories.
    # if file_path is absolute path, nothing we can do :(
    if not os.path.isabs(file_path):
        for search_path in px.path:
            path = os.path.join(search_path, file_path)
            if os.path.isfile(path):
                return path

    raise FileNotFoundError(f"No such file: '{file_path}'")