When do you use threads and when do you use processes in Python?
The decision comes down to what your work is waiting on, and the earlier questions in this topic covered the lock and the threads, so this answer compares the two tools side by side.
Use threads when the work is I/O-bound. That means network calls, database queries, file reads, or waiting for a lock or a subprocess. Threads share memory, so handing a result from one thread to another costs nothing, and the interpreter switches between them whenever one of them has to wait. A thousand threads waiting on HTTP responses at the same time is a perfectly reasonable design.
Use processes when the work is CPU-bound. That means number crunching, image processing, compression, or heavy parsing. Processes have separate memory and therefore separate interpreters, so they run on separate cores with no lock contention at all. The cost is that they cannot share ordinary Python objects. State has to be sent through a multiprocessing.Queue or a Pipe, and everything that crosses that border has to be picklable.
There is a third option that is worth knowing about. The concurrent.futures module gives you both tools behind one interface. ThreadPoolExecutor handles I/O work and ProcessPoolExecutor handles CPU work, and the way you call them is the same in both cases, so changing your mind later is a one-line change. The futures that come back also give you a clean way to submit work, wait for a result, and handle a failure.
Two practical points are worth having ready for an interview. The cost of starting a process is much higher than the cost of starting a thread, because a process means starting a whole interpreter and copying or rebuilding the state. And in Python 3.8 and later the default start method on Linux changed to fork, which is cheap but can be unsafe in a program that already has threads. The forkserver and spawn methods are the safer choices when you care about that.