FlaskFM Project Step 14 Import Error

Hey there,
In the FlaskFM Project Step 14 i get a import error but I till now I could not figure out where the problem’s lying.

Following the two docs (app.py and models.py)

app.py
from flask import Flask, render_template

from flask_sqlalchemy import SQLAlchemy

app = Flask(__name__)

app.config['SQLALCHEMY_DATABASE_URI'] = 'sqlite:///song_library.db'

app.config['SQLALCHEMY_TRACK_MODIFICATIONS'] = False

app.config['SECRET_KEY'] = 'you-will-never-guess'

#create an SQLAlchemy object named `db` and bind it to your app

db = SQLAlchemy(app)

#a simple initial greeting

@app.route('/')

@app.route('/index')

def greeting():

    return render_template('greeting.html')

# app name 

@app.errorhandler(404) 

def not_found(e): 

  return render_template("404.html") 

#uncomment the code below here when you are done creating database instance db and models

#import routes
models.py
from app import app, db


#the User model: each user has a username, and a playlist_id foreign key referring
#to the user's Playlist
class User(db.Model):
  id = db.Column(db.Integer, primary_key = True)
  username = db.Column(db.String(50), index = True, unique = True) 
  playlist_id = db.Column(db.Integer,  db.ForeignKey('playlist.id'))
  
  #representation method
  def __repr__(self):
    return "{} by {}".format(self.title, self.author)

#create the Song model here + add a nice representation method
  class Song(db.Model):
    id = db.Column(db.Integer, primary_key = True)
    artist = db.Column(db.String(50), index=True, unique=True)
    title = db.Column(db.String(70), index=True, unique=True)
    n = db.Column(db.Integer, index=False, unique=False)
 
#create the Item model here + add a nice representation method
  class Item(db.Model):
    id =db.Column(db.Integer, primary_key = True)
    foreign_key = db.Column(db.Integer, db.ForeignKey("song.id"))

#create the Playlist model here + add a nice representation method
  class Playlist(db.Model):
    id =db.Column(db.Integer, primary_key = True)
    items = db.relationship('Item', backref='playlist', lazy='dynamic')

  class RelatedModel(db.Model):
    id = db.Column(db.Integer, primary_key = True)

  class MyModel(db.Model):
    id = db.Column(db.Integer, primary_key = True)
    playlist_id = db.Column(db.Integer, db.ForeignKey('playlist.id')) #a foreign key

after step 13 I exited the terminal session as said
and then I executed “python3 add_data.py”

from the Terminal then I get always the following error

$ python3 add_data.py
Traceback (most recent call last):
File “add_data.py”, line 2, in
from models import Song, Playlist, Item, User
ImportError: cannot import name 'Song’
$

SOLVED it :blush: :blush: