<h3 dir="auto">Apache Airflow version</h3>
<p dir="auto">2.3.2 (latest released)</p>
<h3 dir="auto">What happened</h3>
<p dir="auto">I accidentally created two dags with the same name.<br>
No errors were given.<br>
Code-tab in web-ui showed one of the versions.<br>
Running the task actually executed the second version.</p>
<h3 dir="auto">What you think should happen instead</h3>
<p dir="auto">One, or both DAGs should be rejected and pop up a dag import error in the UI<br>
Starting the dag should not be possible.</p>
<h3 dir="auto">How to reproduce</h3>
<p dir="auto">Create two dags with same name.<br>
Start dag</p>
<h3 dir="auto">Operating System</h3>
<p dir="auto">Debian GNU/Linux 11 (bullseye)</p>
<h3 dir="auto">Versions of Apache Airflow Providers</h3>
<p dir="auto">apache-airflow-providers-celery==3.0.0<br>
apache-airflow-providers-cncf-kubernetes==4.0.2<br>
apache-airflow-providers-docker==3.0.0<br>
apache-airflow-providers-ftp==2.1.2<br>
apache-airflow-providers-http==2.1.2<br>
apache-airflow-providers-imap==2.2.3<br>
apache-airflow-providers-postgres==5.0.0<br>
apache-airflow-providers-sqlite==2.1.3</p>
<h3 dir="auto">Deployment</h3>
<p dir="auto">Other Docker-based deployment</p>
<h3 dir="auto">Deployment details</h3>
<p dir="auto"><em>No response</em></p>
<h3 dir="auto">Anything else</h3>
<p dir="auto"><em>No response</em></p>
<h3 dir="auto">Are you willing to submit PR?</h3>
<ul class="contains-task-list">
<li class="task-list-item"><input type="checkbox" id="" disabled="" class="task-list-item-checkbox"> Yes I am willing to submit a PR!</li>
</ul>
<h3 dir="auto">Code of Conduct</h3>
<ul class="contains-task-list">
<li class="task-list-item"><input type="checkbox" id="" disabled="" class="task-list-item-checkbox" checked=""> I agree to follow this project's <a href="https://github.com/apache/airflow/blob/main/CODE_OF_CONDUCT.md">Code of Conduct</a></li>
</ul>
<p dir="auto"></p><div class="Box Box--condensed my-2">
  <div class="Box-header f6">
    <p class="mb-0 text-bold">
      <a href="https://github.com/apache/airflow/blob/ffb1fcacff21c31d7cacfbd843a84208fca38d1e/airflow/plugins_manager.py#L291-L292">airflow/airflow/plugins_manager.py</a>
    </p>
    <p class="mb-0 color-fg-muted">
        Lines 291 to 292
      in
      <a data-pjax="true" class="commit-tease-sha" href="/apache/airflow/commit/ffb1fcacff21c31d7cacfbd843a84208fca38d1e">ffb1fca</a>
    </p>
  </div>
  <div itemprop="text" class="Box-body p-0 blob-wrapper blob-wrapper-embedded data">
    <table class="highlight tab-size mb-0 js-file-line-container" data-tab-size="8" data-paste-markdown-skip="">

        <tbody><tr class="border-0">
          <td id="L291" class="blob-num border-0 px-3 py-0 color-bg-default" data-line-number="291"></td>
          <td id="LC291" class="blob-code border-0 px-3 py-0 color-bg-default blob-code-inner js-file-line"> <span class="pl-en">load_plugins_from_plugin_directory</span>() </td>
        </tr>

        <tr class="border-0">
          <td id="L292" class="blob-num border-0 px-3 py-0 color-bg-default" data-line-number="292"></td>
          <td id="LC292" class="blob-code border-0 px-3 py-0 color-bg-default blob-code-inner js-file-line"> <span class="pl-en">load_entrypoint_plugins</span>() </td>
        </tr>
    </tbody></table>
  </div>
</div>
<br>
Currently, entrypoint plugins are loaded after plugins directory plugins. If there's not a specific reason for this ordering, I think these should be reversed.<p></p>
<p dir="auto">For example, if I have a custom operator <code class="notranslate">MyOperator</code> that I want to derive from another developer's custom operator <code class="notranslate">TheirOperator</code>, and that operator is part of a package that uses the Airflow plugins entrypoint, I would probably have a <code class="notranslate">my_operator.py</code> file that looks like this:</p>
<div class="highlight highlight-source-python notranslate position-relative overflow-auto" dir="auto" data-snippet-clipboard-copy-content="from airflow.operators.their_plugin import TheirOperator

class MyOperator(TheirOperator):
    ...
    ..."><pre class="notranslate"><span class="pl-k">from</span> <span class="pl-s1">airflow</span>.<span class="pl-s1">operators</span>.<span class="pl-s1">their_plugin</span> <span class="pl-k">import</span> <span class="pl-v">TheirOperator</span>

<span class="pl-k">class</span> <span class="pl-v">MyOperator</span>(<span class="pl-v">TheirOperator</span>):
    ...
    ...</pre></div>
<p dir="auto">As it stands, since <code class="notranslate">MyOperator</code> is loaded first, this will fail with <code class="notranslate">ModuleNotFoundError</code> on <code class="notranslate">their_package.plugins</code>, making it difficult to derive operators from other packages.</p>