Flask Blueprint AttributeError: ‘module’ object has no attribute ‘name’ error

You are trying to register the module and not the contained Blueprint object.

You’ll need to introspect the module to find Blueprint instances instead:

if mod_name not in sys.modules:
    loaded_mod = __import__(EXTENSIONS_DIR+"."+mod_name+"."+mod_name, fromlist=[mod_name])
    for obj in vars(loaded_mod).values():
        if isinstance(obj, Blueprint):
            app.register_blueprint(obj)

Leave a Comment

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)