You can use py-spy to profile already running Python code without restarting your process or modifying the source code.

» Matt Wright | wrighters.io