Looks like maybe you forgot to indent
with conversion_lock: path_to_pdf = convert_file_to_pdf(target_path) logger.info(f"Path to pdf:{path_to_pdf}")
The last line.