Any way to have Python script wait for Audacity to open?

I have a script, and I need it to wait to run when Audacity is fully opened. Any ideas?

Use try / except to connect to the named pipe. On failure, wait for a second and try again (in a loop) until it can connect.

I already tried that. It’s starts running my script when Audacity is opening, and not fully opened. I get the error: “disconnected pipe”.