t = None
for fname in download(urls):
    if t is not None:
        t.join()
t = threading.Thread(target=process, args=(fname,))
t.start()
print('[i] thread started for %s' % fname)
Concurrent download and processing of large files in python