Based on my testing, this is because threads can only be started once, and as the timer relies on a thread, the timer can only be started once. This means that the only way to re-start the timer would be to do:

def newTimer():
    global t
    t = Timer(10.0,api_call)
newTimer()

instead of the t = Timer part, and do

t.cancel()
newTimer()
t.start()

instead of the current re-start code.

This makes your full code:

from threading import Timer

def api_call():
    print("Call that there api")

def newTimer():
    global t
    t = Timer(10.0,api_call)
newTimer()


def my_callback(channel):

    if something_true:
        print('reset timer and start again')
        t.cancel()
        newTimer()
        t.start()
        print("\n timer started")
    elif something_else_true:
        t.cancel()
        print("timer canceled")
    else:
       t.cancel()
       print('cancel timer for sure')

try:
    if outside_input_that_can_happen_a_lot:
        my_callback()

finally:
    #cleanup objects

Hope this helps.

Answer from CrazySqueak on Stack Overflow
🌐
GitHub
gist.github.com › aeroaks › ac4dbed9c184607a330c
Reset Timer in Python · GitHub
Reset Timer in Python. GitHub Gist: instantly share code, notes, and snippets.
Discussions

Created My First Tkinter Project: Count-Down Timer : Reset/pause and resume buttons.
pause = "No" an option is to use paused = False which is more pythonic. Glad you are having fun More on reddit.com
🌐 r/learnpython
10
52
March 20, 2023
python - How to set a timer & clear a timer? - Stack Overflow
I want to create a timer. When it times out, some actions will be taken. But, I can interrupt this timer and reset it. The pseudo code looks like below: def timeout(): print "time out!&quo... More on stackoverflow.com
🌐 stackoverflow.com
Python: Run code every n seconds and restart timer on condition - Stack Overflow
The code assumes that the sleep ... before Python 3.5, the sleep may be interrupted by a signal). The code also assumes no function takes significant (around a second) time. Otherwise, you should use an explicit deadline instead (the same code structure): deadline = timer() + timeout # reset while True: ... More on stackoverflow.com
🌐 stackoverflow.com
Timer cannot restart after it is being stopped in Python - Stack Overflow
I am using Python 2.7. I have a timer that keeps repeating a timer callback action until it has been stopped. It uses a Timer object. The problem is that after it has been stopped, it cannot be res... More on stackoverflow.com
🌐 stackoverflow.com
June 6, 2014
🌐
PyPI
pypi.org › project › resettabletimer
Client Challenge
JavaScript is disabled in your browser · Please enable JavaScript to proceed · A required part of this site couldn’t load. This may be due to a browser extension, network issues, or browser settings. Please check your connection, disable any ad blockers, or try using a different browser
🌐
Real Python
realpython.com › python-timer
Python Timer Functions: Three Ways to Monitor Your Code – Real Python
December 8, 2024 - On the other hand, when you call .stop(), you first check that the Python timer is running. If it is, then you calculate the elapsed time as the difference between the current value of perf_counter() and the one that you stored in ._start_time. Finally, you reset ._start_time so that the timer can be restarted, and print the elapsed time.
🌐
YouTube
youtube.com › the python oracle
Python timer start and reset - YouTube
Become part of the top 3% of the developers by applying to Toptal https://topt.al/25cXVn--Music by Eric Matyashttps://www.soundimage.orgTrack title: Darkness...
Published   January 2, 2023
Views   322
🌐
Raspberry Pi Forums
forums.raspberrypi.com › board index › programming › python
A resetable background timer? - Raspberry Pi Forums
set a timer counter to zero to begin with. Increment the timer at regular intervals, when the timer reaches a value it has "timed out". On an "activity" event reset the timer counter value to zero.
Find elsewhere
🌐
Raspberry Pi Forums
forums.raspberrypi.com › board index › programming › python
Tkinter inactivity reset timer - Raspberry Pi Forums
I could set a variable to 90, then do an after that calls a function after 1 second that subtracts 1 and checks to see if my counter is 0. But then I need to also set reset to 90 if a key is actually pressed. If someone has done this, could you please point me in the right direction?
🌐
Reddit
reddit.com › r/learnpython › created my first tkinter project: count-down timer : reset/pause and resume buttons.
r/learnpython on Reddit: Created My First Tkinter Project: Count-Down Timer : Reset/pause and resume buttons.
March 20, 2023 -

Been learning functions and how to add them to buttons and working with time in general. So wanted to create a little project that will test me on those areas.

import tkinter as tk
from tkinter import *
import time


root = Tk()
root.title('                                      COUNT-DOWN TIMER')
#root.geometry("800x400")
root['background']='#2F4F4F'

total_time = 0

rest = 0

pause = "No"

#####ADD/MINUS/RESET FUNCTIONS

def add_time_hour():
    global total_time
    total_time += 3600
    countdown_label.config(text=f"{total_time//3600:02}:{(total_time//60)%60:02}:{total_time%60:02}",fg = '#00FF00',font=("Arial", 24))

def add_time_min():
    global total_time
    total_time += 60
    countdown_label.config(text=f"{total_time//3600:02}:{(total_time//60)%60:02}:{total_time%60:02}",fg= "#00FF00",font=("Arial", 24))

def add_time_sec():
    global total_time
    total_time += 1
    countdown_label.config(text=f"{total_time//3600:02}:{(total_time//60)%60:02}:{total_time%60:02}",fg= "#00FF00",font=("Arial", 24))

def add_rest_min():
    global rest
    rest += 60
    rest_label.config(text=f"{(rest // 3600) % 3600:02}:{(rest // 60) % 60:02}:{rest % 60:02}",fg= "#00FF00",font=("Arial", 24))

def reset():
    global total_time, rest,pause
    pause = "No"
    total_time = 0
    rest = 0
    countdown_label.config(text=f"{total_time//3600:02}:{(total_time//60)%60:02}:{total_time%60:02}",fg= "#00FF00",font=("Arial", 24))
    rest_label.config(text=f"{(rest // 3600) % 3600:02}:{(rest // 60) % 60:02}:{rest % 60:02}",fg= "#00FF00",font=("Arial", 24))

############TIME FUNCTIONS#############################################

def countdown():
    global total_time,rest, pause
    if total_time > 0 and pause == "No":
        total_time -= 1
        countdown_label.config(text=f"{(total_time // 3600) % 3600:02}:{(total_time // 60) % 60:02}:{total_time % 60:02}",fg="#00FF00", font=("Arial", 24))
        root.after(1000,countdown)
        if total_time == 0:
            countdown_label.config(
                text=f"{(total_time // 3600) % 3600:02}:{(total_time // 60) % 60:02}:{total_time % 60:02}", fg="red",
                font=("Arial", 24))

    elif total_time == 0 and rest > 0 and pause == "No":
        rest -= 1
        rest_label.config(text=f"{(rest// 3600) % 3600:02}:{(rest // 60) % 60:02}:{rest % 60:02}", fg="#00FF00", font=("Arial", 24))
        root.after(1000,countdown)
        if rest == 0:
            rest_label.config(text=f"{(rest // 3600) % 3600:02}:{(rest // 60) % 60:02}:{rest % 60:02}", fg="red",
                              font=("Arial", 24))

def countdown_pause():
    global pause
    pause = "Yes"

def countdown_unpause():
    global pause
    pause = "No"
    countdown()

#############LABELS####################
countdown_label = tk.Label(text = "00:00:00",fg="#00FF00",bg='#2F4F4F', font=("Arial", 24))
countdown_label.grid(row= 0, column = 2, columnspan=2)

countdown_label_title = tk.Label(text = "RUNNING: ",fg="#00FF00",bg='#2F4F4F', font=("Arial", 24))
countdown_label_title.grid(row= 0, column = 0, columnspan=2)

rest_label = tk.Label(text = "00:00:00", fg= "#00FF00",bg='#2F4F4F',font=("Arial", 24))
rest_label.grid(row= 1, column = 2, columnspan=2)

rest_label_title = tk.Label(text = "RESTING: ",fg="#00FF00",bg='#2F4F4F', font=("Arial", 24))
rest_label_title.grid(row= 1, column = 0, columnspan= 2)

#BUTTONS###
add_button = tk.Button(root, text="START", command=countdown, bg='#36648B', font=("Arial", 18))
add_button.grid(row= 3, column = 1)

add_button = tk.Button(root, text="+HOUR", command=add_time_hour, bg='#36648B', font=("Arial", 18))
add_button.grid(row= 2, column = 0)

add_button = tk.Button(root, text="+MNTS", command=add_time_min, bg='#36648B', font=("Arial", 18))
add_button.grid(row= 2, column = 1)

add_button = tk.Button(root, text="+SCND", command=add_time_sec, bg='#36648B', font=("Arial", 18))
add_button.grid(row= 2, column = 2)

add_button = tk.Button(root, text="RESET ", command=reset, bg='#36648B', font=("Arial", 18))
add_button.grid(row= 3, column = 0)

add_button = tk.Button(root, text="RST-MIN", command=add_rest_min, bg='#36648B', font=("Arial", 18))
add_button.grid(row= 2, column = 3)

add_button = tk.Button(root, text="PAUSE", command=countdown_pause, bg='#36648B', font=("Arial", 18))
add_button.grid(row= 3, column = 2)

add_button = tk.Button(root, text="RESUME", command=countdown_unpause, bg='#36648B', font=("Arial", 18))
add_button.grid(row= 3, column = 3)

root.mainloop()
🌐
Python
mail.python.org › pipermail › tutor › 2012-November › 092767.html
[Tutor] Reusing Timers (threading.timer)
November 14, 2012 - > 2. Can I stop the timer, change the value, and restart it (or would it > create a new timer), or do I have to create a new timer with an entirely > new name? Changing the timer is not supported. I expect that calling my_timer.start() after cancelling it would restart it, but haven't tested it.
🌐
YouTube
youtube.com › watch
How to Add Pause and Reset Buttons to Your Python Timer App (Step-by-Step) - YouTube
In this tutorial, we’re upgrading the Study Buddy app by adding Pause and Reset buttons using Python’s Tkinter library!🔍 What You’ll Learn:How to implement ...
Published   November 27, 2024
🌐
Reddit
reddit.com › r/learnpython › how do i stop a function and restart it when it is called again?
r/learnpython on Reddit: How do I stop a function and restart it when it is called again?
August 18, 2021 -

I've searched around the internet and I can't seem to find an answer. I have a series of checkboxes that when clicked, calls a function that is a countdown timer. If I wait for the timer to end, and click another checkbox, it works fine. But if I check a second box while the other is still running, it starts another timer so then I have 2 timers running... or 3 or 4 depending on how many checkboxes I click. If I click another checkbox while the timer is still running, how do I get it to stop the first timer and start over?

def countdown(count):
	import beepy
	label['text'] = count 
	if count >= 0:
		root.after(1000, countdown, count - 1)
	else:
		beepy.beep(4)
		label['text'] = 0

each checkbox has this code to call the countdown function:

ttk.Checkbutton(routine, command=lambda: countdown(45))