I want import import something from database and models files
from ..database import SessionLocal
from ..models import Todos
from ..database import SessionLocal
ImportError: attempted relative import beyond top-level package
I want import import something from database and models files
from ..database import SessionLocal
from ..models import Todos
from ..database import SessionLocal
ImportError: attempted relative import beyond top-level package
There is a great related comprehensive answer here: Relative imports for the billionth time .
You can make an absolute import: from TodoApp.database import ..
. Or also modify your PYTHONPATH
configuration in Pycharm to add the directory where the modules are located (beware of name conflicts with stdlib modules in that case), and import them directly (without dots to indicate relative imports).