contents of "init.py" file inside "handlers" folder:
from handlers import client
from handlers import admin
from handlers import other
and the content of the "main.py" file looks like this inside the main folder:
from aiogram.utils import executor
from datetime import datetime
from create_bot import dp
from handlers import client, admin, other
client.register_handlers_client(dp)
other.register_handlers_other(dp) #last one!
async def on_startup(_):
start_time = datetime.now().strftime("%Y-%m-%d %H:%M:%S")
print("Bot went online at " + start_time)
if __name__ == '__main__':
executor.start_polling(dp, skip_updates=True, on_startup=on_startup)
the file structure of my project (this is a telegram bot) looks like this:
test_bot ---> __pycache__
|
|---> handlers ---> client.py, other.py,__init__.py
|
'---> main ---> main.py,config_testbot.py,etc...
when running the "main.py" file in cmd it outputs the following:
Traceback (most recent call last):
File "main.py", line 5, in <module>
from handlers import client, admin, other
ModuleNotFoundError: No module named 'handlers'
And so, how to run the file "main.py" without error? How to replace from handlers import client, admin, other so that everything works without errors?! My python version 3.8.10. I hope you can help me with this problem, thanks in advance!