i have a folder with a bot and a folder with a future api. The problem is that when I try to import a class from the database folder in the bot, it gives an error that this package does not exist. inits are all written, what could be wrong? Or how to fix it?
In the bot folder in the init, I do the import - from .database import GetCategories
Next in the api folder (top) I try to import this class into the main.py file - from bot import GetCategories
But I get an error - ModuleNotFoundError: No module named 'bot'
Example:
folder api:
main.py code:
from fastapi import FastAPI
from bot import GetCategories
app = FastAPI()
@app.get("/get_categories/{auth_token}")
def read_item(auth_token: str):
i = GetCategories()
return 'test'
folder bot:
init code: from .database import GetCategories
folder database:
init code: from .categories import GetCategories
categories.py code:
class GetCategories:
print('done')
run main.py in folder api: uvicorn main:app --reload