Isn't it enough just using remove_tab method?
If not, and you need to simulate a click on a button:
Lets think you connect your "my_button" button like this:
And you have the "on button click" function:
First create an InputEventAction and set an action name you are not using in your InputMaps, for example "custom_action", and set it pressed:
var ie = InputEventAction.new()
ie.action = "custom_action"
ie.pressed = true
Then parse it to Input to be handled:
Now in the button, override input method and make it emit the "button down" signal that you connected to the method that handles the button click, when the "custom_action" event reaches Input:
That's all, every time you want to emulate the click, parse the custom event to Input.
EDIT: Well, you actually need to register the action in the InputMap on your project setting to avoid errors on debug.