Sonoma - change display order?

Studio M2 running Sonoma. I have three displays: an Apple Studio, which has the menu bar (“displays have separate spaces” is turned off), in the middle and a 24" display on either side of it. I have arranged them so the cursor moves between them as expected, reflecting their physical layout.

I have software which uses “screen number 2” for a secondary display. I want this always to be the left-hand 24" screen. Sometimes it is and sometimes (after a restart) it isn’t. How do I set the screen order (this is distinct from the screen arrangement)? I imagine physically unplugging the right-hand display and reconnecting it would do the trick, but I’d rather prefer a software solution.

I’d love a solution too. The screen numbering used to respect screen placement, but now seems to rely on the order in which the signals are sent to each display on startup or wake from sleep. I have six displays, so you can imagine how much more fun I have. FWIW, Keyboard Maestro somehow knows which display is which by number, so i suspect that the software you speak of is simply using the wrong method; in my case, that’s KeyCue (and a couple other less important examples). I’ve written the developer numerous times asking for a n improvement that calls up the display candidates by name and uuid, but he’s apparently not concerned with multiple displays support.

Also, FWIW, this issue is pretty much only on my Mac Studio M3 Ultra; my old cMP with two video cards seems to always fire up the displays in the same order; so maybe the problem would exist if I swapped cables around to different ports. At times when I’ve done that (for other reasons), macOS still knows their virtual placement based on the unique identifier of each display, but the screen numbers do change in AppleScript. Both of these Macs are on Sequoia.