Disabling program mode when using more than one Teensy?

Hi. Apologies if this is a silly question!

Is it possible to set up a Teensy (in Arduino) to not be programmable until I press the program button?

So until I press it, it just runs it's code and is not programmable ... but if I press the button and upload the sketch again with different settings, it's back to normal programmable mode?

This isn't a blocker for me, but I think it would be helpful when working with more than one Teensy at once.

Would it be enough for you to deactivate the auto programming in the Teensyloader?

You have to choose the right port/Teensy in any case. This would prevent to accidently program the wrong device.
I remember accidentally causing the reverse of this - I could only program the lone Teensy by pushing the program button, even though USB was working fine

I did this by changing the PRODUCT_ID value in usb_desc.h to a low value like 0x0001

You could find the _reboot_Teensyduino_() function and delete its code.

Finding the correct file on your hard drive can be a challenge. Pay attention to the folder name, as separate code is used for Teensy 3.x vs Teensy 4.x, and you might have multiple copies if you have more than one Arduino IDE installed. I'd suggest to first add a syntax error, then click Verify in Arduino. Actually seeing the error confirms you edited the correct file.
TyCommander can be used as SerMon for multiple Teensys and selectively put them in bootloader (without changing any cores file).
Very handy with more than one online - each can have SerMon display in same or new window.
This works with a Verify build.
Also boards.local.txt can be edited and it will prompt for which Teensy - that edit is posted somewhere a time or two. That is only less than ideal when the same sketch name is alternatively sent to multiple units, it will track if name is unique to each.

found that boards.local.txt edit here: https://forum.pjrc.com/index.php?th...r-not-returning-from-upload.73886/post-333937
I use multiple T3.6s and T4.1s and I find the following check very useful!
(note these are code snippets, not reviewed for elegance, supplied just to give an idea of what is possible. Feel free to improve it!)
For me it is important to ensure that I am on the correct Teensy before I start setting pinModes.
#define HARDSTOP  while(1==1) {}
#include <TeensyID.h>
// Teensy Serial Number
union {
  uint32_t myTeensySerial;
  uint8_t serial[4];
} myId;

  // Handle the serial number of this Teensy
  myId.myTeensySerial = __builtin_bswap32(myId.myTeensySerial); // IS THIS NECESSARY ? !!!
  Serial.printf("TEENSY SERIAL = %d\n",myId.myTeensySerial);
  if (myId.myTeensySerial!= 288815) {Serial.printf("WRONG TEENSY");HARDSTOP;}