I have a Python script running in Linux (Ubuntu 18.04) that creates processes using [multiprocessing](https://docs.python.org/3/library/multiprocessing.html) library, assigning to them functions to be executed. The problem is that one of these functions gets stuck, and I want to know where it happens. I tried using `python -m trace -l myscript.py`, but it cannot show the functions that are executed in the subprocesses. Although the script below is not the one I am using, this situation also occurs when trying to trace its functions.

```
import multiprocessing

def print_hello():
    print('hello world')

def print_hello_inside_trace():
    print('trace: hello world')

def trace_function():
    print_hello_inside_trace()

if __name__ == '__main__':
    print_hello()
    process = multiprocessing.Process(target=trace_function)
    process.start()
    process.join()

```

So, my question is: is there any way to trace the code executing inside Python subprocesses? Also, as curiosity, is it possible to trace Python threads?