Lesson 6.15 Using Generic Relationships important import

I was struggling to get the tags to show up in the when adding a new product. I kept getting the error

NameError: name ‘TaggedItem’ is not defined

After trying a while to figure out the right syntax to import the TaggedItem class from the tag/models folder, I gave up and went on to the next lesson. And first thing, Mosh shows importing it like so:

from tags.models import TaggedItem

I went back through lesson 15 and and in all the “from … import …” statements and it’s not there! It’s simply the

from . import models

so it won’t import anything from the tags folder since it’s not in the current folder (using the ‘.’ only imports from the current folder.

So make sure to import

from tags.models import TaggedItem

to get it to run!