Home python python. How to make a delay without freezing the program?

python. How to make a delay without freezing the program?

Author

Date

Category

When using Time.Sleep (x), the entire program stops. I do a bot, in which after each action you need to wait. You can’t work all day without stopping? No you can not. After each work, it will be necessary to rest 1 real hour. But Time.Sleep (X) stops the entire program, and after each work, no one can use a bot. How to make a delay, without freezing the program?


Answer 1

I think you must use asyncio.sleep (3600) in your bot.
Then your task will be asynchronous and the rest of the commands will work.

Programmers, Start Your Engines!

Why spend time searching for the correct question and then entering your answer when you can find it in a second? That's what CompuTicket is all about! Here you'll find thousands of questions and answers from hundreds of computer languages.

Recent questions