def main(): lock = Lock() if len(argv) < 2: print('Must have file path argument.') exit() global file_dir file_dir = argv[1] files = glob.glob(f'{file_dir}/out/**/*.jpg', recursive=True) if not path.exists(f'{file_dir}/faces'): mkdir(f'{file_dir}/faces') with Pool(initializer=init_child, initargs=(lock, )) as p: p.map(find_faces, files)