You could use signals to connect from the texture button to the script, you can connect the button pressed and button release, they make it so when the button is pressed it makes a var true and when it is released it sets it to false and then makes
a while loop (or any other thing) to run when that var is true
var pressed = false
func _on_button_up():
pressed = false
func _on_button_down():
pressed = true
func _process(_delta):
while pressed = true: #or if
#Thing you want to run
Though this is a solution, I am going to assume that my way is not the most efficient way.