I have a Python project with the following file structure:
Under each Python file I have shown the lines of code that I am using to import:
.
├── README.md
├── requirements.txt
└── warbot
├── bots
│ ├── __init__.py
│ ├── telegram_bot.py
│ │ │ from warbot.lib.admin import WarBotAdmin
│ │ │ from warbot.lib.vars import TELEGRAM_VARS, DATABASE_FILENAME
│ └── twitter_bot.py
│ │ from warbot.lib.twitter import WarBotTwitter
│ │ from warbot.lib.vars import TWITTER_VARS, DATABASE_FILENAME
├── database
│ └── warbot_db.json (TinyDB database)
├── __init__.py
├── lib
│ ├── admin.py
│ │ │ from .telegram import TelegramInterface
│ │ │ from .database import WarBotDB
│ │ │ from .warbot import WarBot
│ │ │ from .vars import log
│ ├── api.py
│ │ │ from .database import WarBotDB
│ ├── database.py
│ │ │ from .vars import log
│ ├── imagehandler.py
│ ├── __init__.py
│ ├── telegram.py
│ ├── twitter.py
│ │ │ from .warbot import WarBot
│ │ │ from .api import WarBotAPI
│ │ │ from .database import WarBotDB
│ │ │ from .imagehandler import WarBotImageHandler
│ ├── vars.py
│ └── warbot.py
│ │ from .database import WarBotDB
├── __main__.py
├── output (some logs)
│ ├── logs_telegram.txt
│ └── logs_twitter.txt
├── resources
│ ├── (various resources)
└── tmp
└── info.txt
I am trying to compile the telegram_bot.py and twitter_bot.py files, but their compilation result in a ModuleNotFoundError: No module named warbot.
Furthermore, when I try to compile, just to check the imports, the file admin.py (as an example), it throws me ModuleNotFoundError: No module named '__main__.telegram'; '__main__' is not a package.
I have been documenting myself about Python imports, and even my IDE does not lint errors at this structure.