title: Call a function from within another function in Python
body: <p>I'm starting to learn Python, but I'm having an issue with my code and was hoping someone could help. I have two functions, and I would like to call one function from the other. When I simply tried calling the function, it seemed to be ignored so I'm guessing it's an issue with how I have called it. Below is the snippet of my code in question.</p>
  
  <pre><code># Define the raw message function
  def raw(msg):
      s.send(msg+'\r\n')
  
      # This is the part where I try to call the output function, but it
      # does not seem to work.
      output('msg', '[==&gt;] '+msg)
  
      return
  
  # Define the output and error function
  def output(type, msg):
      if ((type == 'msg') &amp; (debug == 1)) | (type != msg):
          print('['+strftime("%H:%M:%S", gmtime())+'] ['+type.upper()+'] '+msg)
      if type.lower() == 'fatal':
          sys.exit()
      return
  
  # I will still need to call the output() function from outside a
  # function as well. When I specified a static method for output(),
  # calling output() outside a function (like below) didn't seem to work.
  output('notice', 'Script started')
  
  raw("NICK :PythonBot")
  </code></pre>
  
  <p>Edited. I am actually calling the raw() function, it was just below the snippet. :)</p>