<p dir="auto">When setting <code class="notranslate">url_prefix</code> in <code class="notranslate">app.register_blueprint</code> it does not update the blueprints <code class="notranslate">url_prefix</code> property.<br>
Not sure if this is a bug or intentional but seems odd.</p>
<hr>
<p dir="auto">Example:<br>
<strong>app.py</strong></p>
<div class="highlight highlight-source-python notranslate position-relative overflow-auto" dir="auto" data-snippet-clipboard-copy-content="from flask import Flask
import bp


def create_app():
    app = Flask(__name__)

    with app.app_context():
        app.register_blueprint(bp.v, url_prefix=&quot;/custom-prefix&quot;)

    return app"><pre class="notranslate"><span class="pl-k">from</span> <span class="pl-s1">flask</span> <span class="pl-k">import</span> <span class="pl-v">Flask</span>
<span class="pl-k">import</span> <span class="pl-s1">bp</span>


<span class="pl-k">def</span> <span class="pl-en">create_app</span>():
    <span class="pl-s1">app</span> <span class="pl-c1">=</span> <span class="pl-v">Flask</span>(<span class="pl-s1">__name__</span>)

    <span class="pl-k">with</span> <span class="pl-s1">app</span>.<span class="pl-en">app_context</span>():
        <span class="pl-s1">app</span>.<span class="pl-en">register_blueprint</span>(<span class="pl-s1">bp</span>.<span class="pl-s1">v</span>, <span class="pl-s1">url_prefix</span><span class="pl-c1">=</span><span class="pl-s">"/custom-prefix"</span>)

    <span class="pl-k">return</span> <span class="pl-s1">app</span></pre></div>
<p dir="auto"><strong>bp.py</strong></p>
<div class="highlight highlight-source-python notranslate position-relative overflow-auto" dir="auto" data-snippet-clipboard-copy-content="from flask import Blueprint

v = Blueprint('the_blueprint', __name__, url_prefix='/default-prefix')


@v.route('/')
def index():
    return f&quot;url_prefix: {v.url_prefix}&quot;"><pre class="notranslate"><span class="pl-k">from</span> <span class="pl-s1">flask</span> <span class="pl-k">import</span> <span class="pl-v">Blueprint</span>

<span class="pl-s1">v</span> <span class="pl-c1">=</span> <span class="pl-v">Blueprint</span>(<span class="pl-s">'the_blueprint'</span>, <span class="pl-s1">__name__</span>, <span class="pl-s1">url_prefix</span><span class="pl-c1">=</span><span class="pl-s">'/default-prefix'</span>)


<span class="pl-en">@<span class="pl-s1">v</span>.<span class="pl-en">route</span>(<span class="pl-s">'/'</span>)</span>
<span class="pl-k">def</span> <span class="pl-en">index</span>():
    <span class="pl-k">return</span> <span class="pl-s">f"url_prefix: <span class="pl-s1"><span class="pl-kos">{</span><span class="pl-s1">v</span>.<span class="pl-s1">url_prefix</span><span class="pl-kos">}</span></span>"</span></pre></div>
<p dir="auto"><strong>run</strong></p>
<div class="highlight highlight-source-shell notranslate position-relative overflow-auto" dir="auto" data-snippet-clipboard-copy-content="$ FLASK_DEBUG=1 FLASK_APP=app flask run --host 0.0.0.0 --port 5001

$ curl 0.0.0.0:5001/custom-prefix/
url_prefix: /default-prefix"><pre class="notranslate">$ FLASK_DEBUG=1 FLASK_APP=app flask run --host 0.0.0.0 --port 5001

$ curl 0.0.0.0:5001/custom-prefix/
url_prefix: /default-prefix</pre></div>
<hr>
<p dir="auto">I would expect <code class="notranslate">bp.url_prefix</code> to be '/custom-prefix'</p>
<p dir="auto">Environment:</p>
<ul dir="auto">
<li>Python version: 3.8.5</li>
<li>Flask version: 2.0.0 and 1.1.0</li>
</ul>
<p dir="auto">Nested blueprints should be able to have the same name. Currently all blueprints are registered under their own name, however for a nested blueprint id expected it to use the <code class="notranslate">&lt;parent_name&gt;.&lt;child_name&gt;</code></p>
<div class="highlight highlight-source-python notranslate position-relative overflow-auto" dir="auto" data-snippet-clipboard-copy-content="from pprint import pprint
import flask


app = flask.Flask(__name__)
view_bp = flask.Blueprint(&quot;home&quot;, __name__)
api_bp = flask.Blueprint(&quot;api&quot;, __name__, url_prefix=&quot;/api&quot;)
home_api_bp = flask.Blueprint(&quot;home&quot;, __name__)

@view_bp.route(&quot;/&quot;)
@home_api_bp.route(&quot;/&quot;)
def view():
    print(flask.request, flask.request.endpoint)

api_bp.register_blueprint(home_api_bp)

app.register_blueprint(view_bp)
app.register_blueprint(api_bp)
pprint(app.url_map)"><pre class="notranslate"><span class="pl-k">from</span> <span class="pl-s1">pprint</span> <span class="pl-k">import</span> <span class="pl-s1">pprint</span>
<span class="pl-k">import</span> <span class="pl-s1">flask</span>


<span class="pl-s1">app</span> <span class="pl-c1">=</span> <span class="pl-s1">flask</span>.<span class="pl-v">Flask</span>(<span class="pl-s1">__name__</span>)
<span class="pl-s1">view_bp</span> <span class="pl-c1">=</span> <span class="pl-s1">flask</span>.<span class="pl-v">Blueprint</span>(<span class="pl-s">"home"</span>, <span class="pl-s1">__name__</span>)
<span class="pl-s1">api_bp</span> <span class="pl-c1">=</span> <span class="pl-s1">flask</span>.<span class="pl-v">Blueprint</span>(<span class="pl-s">"api"</span>, <span class="pl-s1">__name__</span>, <span class="pl-s1">url_prefix</span><span class="pl-c1">=</span><span class="pl-s">"/api"</span>)
<span class="pl-s1">home_api_bp</span> <span class="pl-c1">=</span> <span class="pl-s1">flask</span>.<span class="pl-v">Blueprint</span>(<span class="pl-s">"home"</span>, <span class="pl-s1">__name__</span>)

<span class="pl-en">@<span class="pl-s1">view_bp</span>.<span class="pl-en">route</span>(<span class="pl-s">"/"</span>)</span>
<span class="pl-en">@<span class="pl-s1">home_api_bp</span>.<span class="pl-en">route</span>(<span class="pl-s">"/"</span>)</span>
<span class="pl-k">def</span> <span class="pl-en">view</span>():
    <span class="pl-en">print</span>(<span class="pl-s1">flask</span>.<span class="pl-s1">request</span>, <span class="pl-s1">flask</span>.<span class="pl-s1">request</span>.<span class="pl-s1">endpoint</span>)

<span class="pl-s1">api_bp</span>.<span class="pl-en">register_blueprint</span>(<span class="pl-s1">home_api_bp</span>)

<span class="pl-s1">app</span>.<span class="pl-en">register_blueprint</span>(<span class="pl-s1">view_bp</span>)
<span class="pl-s1">app</span>.<span class="pl-en">register_blueprint</span>(<span class="pl-s1">api_bp</span>)
<span class="pl-en">pprint</span>(<span class="pl-s1">app</span>.<span class="pl-s1">url_map</span>)</pre></div>

<div class="highlight highlight-text-python-traceback notranslate position-relative overflow-auto" dir="auto" data-snippet-clipboard-copy-content="Traceback (most recent call last):
  File &quot;/home/maico/test.py&quot;, line 18, in &lt;module&gt;
    app.register_blueprint(api_bp)
  File &quot;/home/maico/.local/lib/python3.9/site-packages/flask/scaffold.py&quot;, line 54, in wrapper_func
    return f(self, *args, **kwargs)
  File &quot;/home/maico/.local/lib/python3.9/site-packages/flask/app.py&quot;, line 1023, in register_blueprint
    blueprint.register(self, options)
  File &quot;/home/maico/.local/lib/python3.9/site-packages/flask/blueprints.py&quot;, line 359, in register
    blueprint.register(app, bp_options)
  File &quot;/home/maico/.local/lib/python3.9/site-packages/flask/blueprints.py&quot;, line 275, in register
    assert app.blueprints[self.name] is self, (
AssertionError: A name collision occurred between blueprints &lt;Blueprint 'home'&gt; and &lt;Blueprint 'home'&gt;. Both share the same name 'home'. Blueprints that are created on the fly need unique names."><pre class="notranslate">Traceback (most recent call last):
  File <span class="pl-s">"/home/maico/test.py"</span>, line <span class="pl-c1">18</span>, in <span class="pl-en">&lt;module&gt;</span>
    app.register_blueprint(api_bp)
  File <span class="pl-s">"/home/maico/.local/lib/python3.9/site-packages/flask/scaffold.py"</span>, line <span class="pl-c1">54</span>, in <span class="pl-en">wrapper_func</span>
    <span class="pl-k">return</span> f(<span class="pl-c1">self</span>, <span class="pl-k">*</span>args, <span class="pl-k">**</span>kwargs)
  File <span class="pl-s">"/home/maico/.local/lib/python3.9/site-packages/flask/app.py"</span>, line <span class="pl-c1">1023</span>, in <span class="pl-en">register_blueprint</span>
    blueprint.register(<span class="pl-c1">self</span>, options)
  File <span class="pl-s">"/home/maico/.local/lib/python3.9/site-packages/flask/blueprints.py"</span>, line <span class="pl-c1">359</span>, in <span class="pl-en">register</span>
    blueprint.register(app, bp_options)
  File <span class="pl-s">"/home/maico/.local/lib/python3.9/site-packages/flask/blueprints.py"</span>, line <span class="pl-c1">275</span>, in <span class="pl-en">register</span>
    <span class="pl-k">assert</span> app.blueprints[<span class="pl-c1">self</span>.name] <span class="pl-k">is</span> <span class="pl-c1">self</span>, (
<span class="pl-en">AssertionError</span>: <span class="pl-s">A name collision occurred between blueprints &lt;Blueprint 'home'&gt; and &lt;Blueprint 'home'&gt;. Both share the same name 'home'. Blueprints that are created on the fly need unique names.</span></pre></div>
<p dir="auto">Environment:</p>
<ul dir="auto">
<li>Python version: 3.9.1</li>
<li>Flask version: 2.1.0dev0: <a class="commit-link" data-hovercard-type="commit" data-hovercard-url="https://github.com/pallets/flask/commit/9039534eee6a87da98a1dee9e4338d1b73e861f8/hovercard" href="https://github.com/pallets/flask/commit/9039534eee6a87da98a1dee9e4338d1b73e861f8"><tt>9039534</tt></a></li>
</ul>