Start a program on the PC when Arduino gets connected

I wrote a python program (w/ pySerial) that communicates with the Arduino when connected.
Until now there is another python program in the startup folder of the windows PC that tries to connect every 5 seconds and starts the real program as soon as the test connection succeeded.
I really don't like this approach. Not just because of the unnecessary use of computing performance. It seems wrong to have that program always running in the background.
Is there a different way to start a program on a PC as soon as an Arduino is connected?
Thank you,
Robin

Check out RegisterDeviceNotification() and WM_DEVICECHANGE. Those are probably the closest you'll come without a ton of work. Using these, you might at least avoid scanning over and over, and instead do it only when a possibly-relevant hardware event has occurred. Actually having your app run the instant your device is inserted probably involves having your own hardware IDs, driver, and service.

If you're using Arduinos with FTDI USB chips on them, you could also limit your searching by using the FTDI D2XX API to enumerate only FTDI devices. Further, you could use the FT_PROG app to write a name to your Arduino so that you could simply try opening it by name. When it comes to PC/Arduino interfacing, I pretty much skip the genuine stuff and go straight for the FTDI-based clones, for this reason alone.

(Disclaimer: No idea what Python development of Windows apps looks like. I'm a C++/C# guy.)

row171:
Until now there is another python program in the startup folder of the windows PC that tries to connect every 5 seconds and starts the real program as soon as the test connection succeeded.

Why not simplify that and get your "real program" to run from the startup folder and cut out the middle man.

It's not going to bother the PC having 1 more program running all the time. There are probably 200 doing so already.

...R