No module named 'sleep'

Asked by At

first of all this is my first post so I'm sorry if there's anything I didn't do in order to make it easier to answer to my question.

I am trying to make the program wait for a couple of seconds before moving on to the next piece of code. However I've looked on the internet about my issue but can't seem to find a solution.

This is my code:

from time import sleep

print("Hello")
time.sleep(3)
print("World")

But it returns this ModuleNotFoundError instead:

ModuleNotFoundError: No module named 'sleep'

Thanks in advance!

1 Answers

3
SteliosK On

You could try:

from time import sleep

print("Hello")
sleep(3)
print("World")

Since you import only sleep from the module, you cannot use time.sleep(3), since the module time is not imported.