title: Airflow Packaged Dags (zipped) clash when subfolders have same name
body: <p>We're setting up an Airflow framework in which multiple data scientist teams can orchestrate their data processing pipelines. We've developed a Python code-base to help them implement the DAGs, which includes functions and classes (Operator sub-classes as well) in various packages and modules.</p>
  <p>Every team will have their own DAG packaged in a ZIP file together with the functions and classes in packages. For example first ZIP file would contain</p>
  <blockquote>
  <p>ZIP1:</p>
  <p>main_dag_teamA.py</p>
  <p>subfolder1: package1-with-generic-functions + <strong>init</strong>.py</p>
  <p>subfolder2: package2-with-generic-operators + <strong>init</strong>.py</p>
  </blockquote>
  <p>And another ZIP file would contain</p>
  <blockquote>
  <p>ZIP2:</p>
  <p>main_dag_teamB.py</p>
  <p>subfolder1: package1-with-generic-functions + <strong>init</strong>.py</p>
  <p>subfolder2: package2-with-generic-operators + <strong>init</strong>.py</p>
  </blockquote>
  <p>Please note that in both ZIP files subfolder1 and subfolder2 will usually be exactly the same, meaning exact same files with same functions and classes.
  But in time, when new versions of packages will become available, the package contents will start deviating across the DAG packages.</p>
  <p>With this setup we bump into the following problem: it seems that Airflow is not handling the same-name packages very well when contents of packages/subfolders start deviating across the ZIPs.
  Because when I run &quot;airflow list_dags&quot; it shows errors like:</p>
  <blockquote>
  <p>File &quot;/data/share/airflow/dags/program1/program1.zip/program1.py&quot;, line 1, in &gt;  from subfolder1.functions1 import function1
  ImportError: No module named 'subfolder1.functions1'</p>
  </blockquote>
  <p>Problem can be reproduced with following code, where two small DAGs are in their ZIP files together with package my_functions, which has the same name, but different content.</p>
  <h2>DAG package ZIP 1:</h2>
  <p>program1.py</p>
  <pre class="lang-py prettyprint-override"><code>from my_functions.functions1 import function1
  
  from datetime import datetime
  from airflow import DAG
  from airflow.operators.python_operator import PythonOperator
  
  
  def do_it():
      print('program1')
  
  dag = DAG(
      'program1',
      schedule_interval=None,
      catchup=False,
      start_date=datetime(2019, 6, 23)
  )
  
  hello_operator = PythonOperator(task_id='program1_task1', python_callable=do_it, dag=dag)
  </code></pre>
  <p>my_functions/functions1.py:</p>
  <pre class="lang-py prettyprint-override"><code>def function1():
      print('function1')
  </code></pre>
  <h2>DAG package ZIP 2:</h2>
  <p>program2.py:</p>
  <pre class="lang-py prettyprint-override"><code>from my_functions.functions2 import function2
  
  from datetime import datetime
  from airflow import DAG
  from airflow.operators.python_operator import PythonOperator
  
  
  def do_it():
      print('program1')
  
  dag = DAG(
      'program1',
      schedule_interval=None,
      catchup=False,
      start_date=datetime(2019, 6, 23)
  )
  
  hello_operator = PythonOperator(task_id='program2_task2', python_callable=do_it, dag=dag)
  </code></pre>
  <p>my_functions/functions2.py:</p>
  <pre class="lang-py prettyprint-override"><code>def function2():
      print('function2')
  </code></pre>
  <p>With these two ZIP files when I run &quot;airflow list_dags&quot; it shows an error:</p>
  <p>File &quot;/data/share/airflow/dags/program1/program1.zip/program1.py&quot;, line 1, in 
  from subfolder1.functions1 import function1 ImportError: No module named 'subfolder1.functions1'</p>
  <p>When the contents of the subfolders in the ZIPs are the same, no error occurs.</p>
  <p>My question: how can I prevent this clash of subfolders in ZIPs? I really would like to have fully code independent DAGs, with their own version of packages.</p>