Please be informed that your first code does not explicitly close the pool in python. You have submitted your task with executor.submit(), which is a non-blocking request. Your main code processes to display the statements immediately and just hangs there until all threads have terminated after 19 seconds.
Your other program uses the statement, which in this context is blocking. with ThreadPoolExecutor() method has an implicit shutdown(wait=True), and it blocks there till all threads have finished the processing.
executor = ThreadPoolExecutor(max_workers=2)
executor.submit(wait_on_future)
executor.shutdown(wait=True)
print("elo")
The below python tutorial video will help you get a better understanding of Automate Your Coding with Python!