selenium.common.exceptions.WebDriverException:An unknown server-side error occurred while processing the command. Original error: 'POST/appium/device/press_keycode' cannot be proxied to UiAutomator2 server because the instrumentation process is not runing

I am trying to reestablish the appium server once the device is rebooted within the testcase itself. But once the phone is rebooted, I get this in the logs
[Instrumentation] INSTRUMENTATION_ABORTED: System has crashed.
And I wont be able to perform any clicks using the driver, I get this error:
selenium.common.exceptions.WebDriverException:An unknown server-side error occurred while processing the command. Original error: ‘POST/appium/device/press_keycode’ cannot be proxied to UiAutomator2 server because the instrumentation process is not running(probably crashed). Check the server log and/or the logcat output for more details

Appium version? Looks like you may be trying to invoke a deprecated function.