If a plane's engines were to fail in flight then because most of them have two, the pilot the lands the airplane. Mostly its only one engine and rarely two as what happened with "The Miracle on the Hudson." When the plane lands the aviation engineers then replace the failed component, test its operation and integration and the plane takes back to the skies. They do not do an inflight engine swap out at 10000 ft. However, network engineers seem to always try the latter with spectacular adverse major incidents.
Read the article over at LinkedIn here.