thejdah
thejdah

Reputation: 345

Python can't see import file

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

Answers (1)

Naveen Kumar
Naveen Kumar

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

Related Questions