Auto Switching the TTS engine

I’ve a use case in which I have to switch TTS engine (2 engine already installed - Google and 3rd Party for one of the native language) on a click of a button in my settings page to use TTS accordingly.

Manually, I can do that by navigating to TTS option in phone settings.
I want to achieve this programmatically. Is there any way to do this?

Many thanks in advance.