Skip to content
Sign upLog in
← Back to Community

Module Not Found Error

Profile icon
LohBoon

When input >>>from blog,models import Blog
the output show No module named 'blog', why? how to fixed it?

Thank you.

Voters
Profile icon
samrudhswaminat
Profile icon
LohBoon
Comments
hotnewtop
Profile icon
Coder100

You defined your class as blog silly!

image

Solution

Either rename your class to

class Blog(models.Model):

or import it differently

from blog,models import blog as Blog
Profile icon
Wumi4

Python doesn't allow you to import your file to its shell.