Delay Execution


Hello,

 

I am try to conffigure Python 3.7 that it does not automatically compile and execute.

I would like to create code in one window, then execute in a second window.

Any assistance is appreciated,

Dan

Category: Python
Asked at Oct. 11, 2018, 5:10 p.m. by DanJ4WIcoders

1 Answer


Dan,

I am not 100% sure what you mean by executing in another window. Are we talking in a terminal window? I am also not sure what your knowledge level is.

Your question could simply be solved by creating a Python file and then executing when you want too. To run a Python file you just call python <filename>.py

Now if you mean you want to execute the program at a certain time then you can use the time module to call the sleep method to delay the execution of a program.

import time

while True:
    print("I will print every minute")
    time.sleep(60)

Or you can use the Python event scheduler module to schedule a task here is the documentation.

If I misunderstood you I apologize and let me know. Good luck

Answered on: Oct. 11, 2018, 5:38 p.m.
Answered by: admin