I have attached an ESP8266 to a mega via Serial (TX/RX).
When the ESP8266 gets an HTML command it can pass instructions to the Mega. This all works fine. What I realized is when the two devices are connected over TX/RX I cannot upload fresh sketches to either device. I have to disconnect them.
Anyone know a way around this? This devices will be in a project box in a hard to reach place when they go into "Production" and it will be a terrible inconvenience to disconnect them in the event I have to change sketches.
That's to be expected. Those pins are also used for uploads so the ESP8266 interferes. Luckily you have 3 more hardware serial ports on your Mega, just connect the ESP8266 to a different one and update your code accordingly.