My app randomly started reinstalling everything and now i get the following error

Why can’t the module be found anymore? My app has been running for 2 years and it always worked like this?

Repl link/Link to where the bug appears:

Screenshots, links, or other helpful context:
Folder structure

The error i suddenly start getting which i never got before (i didn’t change the code at all)

Traceback (most recent call last):
  File "", line 4, in <module>
    from modules.keep_alive import keep_alive
ModuleNotFoundError: No module named 'modules.keep_alive'; 'modules' is not a package

Hi @KaanGogcay , welcome tk the forma!
Can you rename the folder name to something else?
Or try this:

with open('/modules/','r') as file:

Hope this helps!


Hey @KaanGogcay Welcome to the forums!

With your file structure, there is no module named modules, or did you mean a package that is named module? If so, please run in shell

pip install modules


poetry add modules

Hope this helps resolve your problem

OP has a folder called modules, and wants to take a function from a file in the folder.

1 Like

Could probably rename the modules folder to mods or something else.

1 Like

That was what I said above ^^

1 Like

Try simply adding a file to modules, you don’t even need anything in it.


you have created a library called modules. But every Python library should have a file in the library folder. In your case, to the file you don’t need to put anything.

File inside the folder tells the Python interpreter that it is not just a folder with files, but a module whose files can be accessed via .

Addition to this post:

1 Like

I wrote from modules.keep_alive import keep_alive

Because this was for me the way to import the function keep_alive() from the file located in the folder modules.

Is there somethint wrong in the way i did it? Because it used to work for 2 years straight but randomly decided not to work anymore.