I am trying to execute some code the moment a specific process pops up in my os, I tried using the psutil
library and it gives me the option to check all my processes, but the problem is that it ins't efficient to keep iterating over all my processes just to check if one exists.
Is there a way to fire a function the moment a process exists or terminates without iteration?