Program ESP01 and keep it after reboot
The ESP-01 ... and all ESP8622 ... have two modes for operation.

Flash mode / Boot load mode - on bootup (at the time an electrical current is first applied, or after the reset pin is grounded), if the GPIO0 (GPIO Zero) pin {On the ESP-01 this is the 7th pin} is connected to ground, the chip goes into non-run, receive program mode.  This is where you load the compiled program.

Normal - on bootup (as above), but GPIO0 is NOT ground, then the ESP-01 goes into run mode.