title: TypeError: 'module' object is not callable - using datetime
body: <p>Sorry didn't find any other fix, so I created a new question.
  I'm trying to run a code that prints to the screen the current hour, minute and second. The piece of code I'm using to do this is:</p>
  
  <pre><code>def time():
      import datetime
      import time
      time.sleep(1)
      nowTime = datetime.now()
      print ('Right now it's %s hours, %s minutes and %s seconds.' % (nowTime.hour,nowTime.minute,nowTime.second))
      time.sleep(5)
  </code></pre>
  
  <p>I get the following error when this piece of code tries to execute:</p>
  
  <blockquote>
  <pre><code>Traceback (most recent call last):
    File "/Users/Teolicht/Desktop/Python/testy.py", line 219, in &lt;module&gt;
      start()
    File "/Users/Teolicht/Desktop/Python/testy.py", line 18, in start
      questions()
    File "/Users/Teolicht/Desktop/Python/testy.py", line 34, in questions
      day()
    File "/Users/Teolicht/Desktop/Python/testy.py", line 52, in day
      time()
  TypeError: 'module' object is not callable
  </code></pre>
  </blockquote>
  
  <p><code>start()</code>, <code>questions()</code> and <code>day()</code> are some other functions the program went through before going through <code>time()</code>. If I try executing <code>time()</code> directly, it works! So, here's the entire code from the start till the end of the <code>time()</code> function:</p>
  
  <pre><code>from datetime import datetime
  import time
  import random
  import sys
  
  def start():
      import time
      name = input('Hi. What is your name? ')
      print ('Nice to meet you, ' + str(name) + '.')
      time.sleep(1)
      print ('How old are you?')
      age = input()
      time.sleep(1)
      print (age + '! Cool.')
      time.sleep(2)
      questions()
  
  def questions():
      import time
      print ('Some things you can ask me:')
      time.sleep(1)
      print ('• What day is today? (qdh)')
      time.sleep(1)
      print ('• What time is it? (qhs)')
      time.sleep(1)
      print ('• I want to play a game! (qjj)')
      time.sleep(1)
      print ('• How many days till my birthday? (qda)')
      time.sleep(1)
      questionsAnswer = input()
      if questionsAnswer == 'qdh':
          day()
      elif questionsAnswer == 'qhs':
          time()
      elif questionsAnswer == 'qjj':
          game()
      else:
          birthday()
  
  def day():
      import time
      time.sleep(1)
      nowDay = datetime.now()
      print ('Today is %s/%s/%s' % (nowDay.day,nowDay.month,nowDay.year))
      time.sleep(2)
      dayAnswer = input('Want to know what time it is? "Y" for yes and "N" for no: ').lower()
      if dayAnswer == 'n':
          questions()
      else:
          time()
  
  def time():
      import time
      time.sleep(1)
      nowTime = datetime.now()
      print ('Right now it's %s hours, %s minutes and %s seconds.' % (nowTime.hour,nowTime.minute,nowTime.second))
      time.sleep(5)
          questions()
         ...
  </code></pre>
  
  <p>It might be something in <code>start()</code>, <code>questions()</code> or <code>day()</code> causing the error. Any ideas? Thanks a bunch!</p>