title: Why does running a submodule (python -m a.c) also import the containing module?
body: <p>Given:</p>
  
  <h1><code>tree</code></h1>
  
  <pre><code>~/dir                                                                          
  ▶ tree
  .
  ├── a
  │   ├── __init__.py
  │   ├── c.py
  └── b.py
  
  1 directory, 3 files
  </code></pre>
  
  <h1><code>*.py</code> files</h1>
  
  <pre><code>~/dir                                                                          
  ▶ tail -n +1 **/*.py                                                  
  ==&gt; a/__init__.py &lt;==
  print(__name__)
  import a.c
  
  ==&gt; a/c.py &lt;==
  print(__name__)
  
  ==&gt; b.py &lt;==
  print(__name__)
  import a
  </code></pre>
  
  <h1>I/O</h1>
  
  <pre><code>~/dir                                                                          
  ▶ python3 -m a.c
  a
  a.c
  __main__
  </code></pre>
  
  <p>Module <code>a.c</code> has no dependencies on module <code>a</code>. So, why does Python run module <code>a</code> as if it were importing it? To me this is surprising behavior. I didn't expect running a script without imports would cause the script itself to be imported and evaluated twice. Wouldn't this be dangerous for the scripts that don't use the protection of <code>if __name__ == "__main__"</code>?</p>
  
  <p>What is the justification for this behavior? Why does Python need to evaluate the containing module upon running its submodule?</p>