Welcome to the forums @steven440!
Which of the print statements is the one that is printing over and over? print("third")?
Taking a quick glance through the code, I think the issue may be that the _on_time_out function calls attack, which resets the timer on line 12 (cooldown.start). Additionally, it could be that is_attacking and enemy_here are set to false, but since the _on_time_out function does not check for this, it continues to print "third".