from time import sleep
from threading import Thread

def some_task():
    while True:
        pass
t = Thread(target=some_task)
t.daemon = True
t.start()
snooziness = int(input(
    'Enter the amount of seconds you want to run this: '))
sleep(snooziness)
Running a python script for a user-specified amount of time?