Recursive function returning none in Python

I have this piece of code, for some reason when I try to return the path, I get None instead: def get_path(dictionary, rqfile, prefix=[]): for filename in dictionary.keys(): path = prefix + [filename] if not isinstance(dictionary[filename], dict): if rqfile in str(os.path.join(*path)): return str(os.path.join(*path)) else: get_path(directory[filename], rqfile, path) Is there a way to solve this? Answers: … Read more