flashing arduino while tx&rx are connected to esp8266

how can i flash at usb while a esp8266 is listening on rx of arduino? i have rx and tx pins connected to arduino and cant flash by usb. do i need a diode on the rx and tx pins?

i have rx and tx pins connected to arduino and cant flash by usb.

You need to use an external programmer and bypass the serial port and boot loader altogether.

You can program another Arduino to act as a programmer.

First you need to specify what sort of ESP8266 you have.

And which Arduino that you have.