title: Python Import Performance - Module vs Function From Module
body: <p>Why does importing the entire module take less time than importing only one function?</p>
  
  <pre><code>%%timeit
  import pid
  </code></pre>
  
  <p><strong>269 ns ± 47.5 ns per loop (mean ± std. dev. of 7 runs, 1000000 loops each)</strong></p>
  
  <pre><code>%%timeit
  from pid import PidFile
  </code></pre>
  
  <p><strong>1.77 µs ± 175 ns per loop (mean ± std. dev. of 7 runs, 100000 loops each)</strong></p>