0

I want import import something from database and models files

from ..database import SessionLocal
from ..models import Todos

and receive enter image description here

 from ..database import SessionLocal
ImportError: attempted relative import beyond top-level package
Miroslaw
  • 11
  • 3

1 Answers1

0

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).

matleg
  • 618
  • 4
  • 11