import keyboard
import time
s = (0)
def func():
while True:
time.sleep(1)
s +=(1)
print(s)
while True:
time.sleep(0.05)
if keyboard.is_pressed('f'):
func()
global s
import keyboard
import time
def func():
s = 0
while True:
time.sleep(1)
s += (1)
print(s)
while True:
time.sleep(0.05)
if keyboard.is_pressed('f'):
func()