title: AttributeError: 'module' object has no attribute 'xxxx'
body: <p>In the current working directory:</p>
  
  <p>The package <code>foo</code> contains the module <code>bar.py</code>, along with an empty <code>__init__.py</code> file.</p>
  
  <p>For argument's sake, the module <code>bar.py</code> contains the following  code:</p>
  
  <pre><code>def print_message():
      print 'The function print_message() prints this message'
  
  print 'The module \"bar\" prints \"bar\"'
  </code></pre>
  
  <p><strong>Expected behaviour</strong> upon <code>import foo</code>:</p>
  
  <ol>
  <li><code>foo.bar</code> to print <code>The module "bar" prints "bar"</code></li>
  <li><code>foo.bar.print_message()</code> to print <code>The function print_message() prints this message</code></li>
  </ol>
  
  <p><strong>Instead</strong>, I struggle with the import of the <code>bar.py</code> module:</p>
  
  <ul>
  <li><p>On one hand, using <code>from foo import bar</code> then allows to call
  <code>bar.print_message()</code></p></li>
  <li><p>On the other hand, if I <code>import foo</code>, then <code>foo.bar</code> yields the
  error in the title: <code>AttributeError: 'module' object has no attribute 'bar'</code>(and so does <code>foo.bar.print_message()</code>)</p></li>
  </ul>
  
  <p>All the best rated questions on SO I've skimmed through so far, with regards to <code>AttributeError</code>, feature an answer related to something within the module, not the import itself. Also, Kernel is restarted between each attempt.</p>
  
  <p><strong>Question:</strong> Not a blocking point as such but it bugs me down not to understand that behaviour. I'm rather inexperienced, so what fondamental concept am I missing here? 
  Thank you, </p>