title: Cannot perform relative import (flask/pycharm)
body: <p>I am fairly new to programming. 
  I am using Pycharm IDE and the flask framework.
  I am now trying to use SQLAlchemy and when I try to run a query (db_create.py) to add stuff in the DB it returns "SystemError: Parent module '' not loaded, cannot perform relative import".</p>
  
  <p>From what I gathered on the internet, it seems to be a Pycharm issue but I dont really understand how to troubleshoot it.</p>
  
  <p>Does anyone have an idea please?</p>
  
  <p>For reference, my project structure is as follows (pjctBB should be tabulated as it it part of pjctMain). </p>
  
  <p>I really appreciate your time in reading this and helpign me out. 
  Thanks in advance!</p>
  
  <pre><code>pjctMain
  ├── run.py
  pjctBB
  ├── __init__.py
  ├── models.py
  ├── views.py
  ├── pjctbb_sg.db 
  └── db_create.py
  </code></pre>
  
  <p>My run.py:</p>
  
  <pre><code>from pjctBB import app
  import os
  
  app.secret_key = os.urandom(24)
  app.run(debug=True)
  </code></pre>
  
  <p>My <strong>init</strong>:</p>
  
  <pre><code>from .views import app
  from .models import *
  </code></pre>
  
  <p>My models.py contains this:</p>
  
  <pre><code>from .views import db
  
  
  class User(db.Model):
  
      __tablename__ = "users"
  
      id = db.Column(db.Integer, primary_key=True)
      email = db.Column(db.String, nullable=False)
      username = db.Column(db.String, nullable=False)
      password = db.Column(db.String, nullable=False)
      rank = db.Column(db.Integer, nullable=False)
  
      def __init__(self, email, username, password, rank):
          self.email = email
          self.username = username
          self.password = password
          self.rank = rank
  </code></pre>
  
  <p>My (partial) views.py has the following:</p>
  
  <pre><code>from flask import Flask, \
                    render_template, request, redirect, url_for, session, flash, json
  # from .models import register1
  import os
  from flask_sqlalchemy import SQLAlchemy
  #import sqlite3
  
  
  #from passlib.hash import bcrypt
  from functools import wraps
  
  app = Flask(__name__)
  app.config['SQLALCHEMY_DATABASE_URI'] = 'sqlite:///pjctbb_sg.db'
  
  # Create SQLAlchemy object
  db = SQLAlchemy(app)
  </code></pre>
  
  <p>Finally, my db_create.py:</p>
  
  <pre><code>from .views import db
  from .models import User
  
  db.create_all()
  
  db.session.add(User("test@test.com", "test", "000000", "50"))
  
  db.session.commit()
  </code></pre>