Reputation: 345
I am building a web application in Python Flask. In my init file, I am importing a .py file named create. The init file cannot find the create file. Both files are in the same directory.
import os
from flask import Flask, request, render_template
from create import createBP
def create_app(test_config=None):
# create and configure the app
app = Flask(__name__, instance_relative_config=True)
app.register_blueprint(createBP)
The error that I am receiving: No module named 'create'.
Upvotes: 1
Views: 192
Reputation: 184
You should import it as module_name.create
.
For example if you module name is app
from app.create import createBP
Upvotes: 1