ValueError: Cannot serialize function: lambda
A thread can be flagged as a “daemon thread”. The significance of this flag is that the entire Python program exits when only daemon threads are left.
There is a “main thread” object; this corresponds to the initial thread of control in the Python program. It is not a daemon thread.