How a computer executes your Python script
This is how your computer's operating system executes Python script:
- When you type
python <your_awesome_automation_script>.py
in the shell, Python (which runs as a process) instructs your computer processor to schedule a thread (which is the smallest unit of processing):

- The allocated thread will start to execute your script, line by line. A thread can do anything, including interacting with I/O devices, connecting to routers, printing output, performing mathematical equations, and more.
- Once the script hits the End of File (EOF), the thread will be terminated and returned to the free pool, to be used by other processes. Then, the script is terminated.
Note
In Linux, you can use #strace –p <pid>
to trace a specific thread execution.
The more threads that you assign to your script (and that are permitted by your processor or OS), the faster your script will run. Actually, threads are sometimes called workers or slaves.
I have a feeling that...