Ask coding questions

← Back to all posts
how do i run a certain code given in a specific time
StupitTurtle (0)

i wrote a code i want to run after 30 min after another code, how do i do that

Answered by OldWizard209 (1517) [earned 5 cycles]
View Answer
OldWizard209 (1517)

if you are using Python, you can use threading or you can use the time module.

import time

def firstFunction():
    print("First function")

firstFunction() # Run the function

time.sleep(1800)# Number of seconds in 30 minutes

def secondFunction():
    print("Second function")

secondFunction() # Run the function
StupitTurtle (0)

@OldWizard209 Thank you very much. It worked!