title: Execute functions apart from argparse which are defined in main in Python
body: <p>I'm using argparse to use user arguments to run functions in my program which is running just fine. But I'm unable to run other generic functions which I'm calling in main(). It just skips those functions without running and showing output. How do I do it or where am I doing wrong ? </p>
  
  <p>Let's say in below program I want functions mytop20 and listapps to be run using user arguments which runs fine if I remove the boilerplate main() function but my objective is run_in_main() function should run in main() </p>
  
  <pre><code>import argparse
  
  def my_top20_func():
      print "Called my_top20_func"
  
  def my_listapps_func():
      print "Called my_listapps_func"
  
  def run_in_main():
      print "Called from main"
  
  parser = argparse.ArgumentParser()
  FUNCTION_MAP = {'top20' : my_top20_func,
                  'listapps' : my_listapps_func }
  
  parser.add_argument('command', choices=FUNCTION_MAP.keys())
  
  args = parser.parse_args()
  
  func = FUNCTION_MAP[args.command]
  func()
  
  if __name__ == "__main__":
      run_in_main()
  </code></pre>
  
  <p>As my use case is quite similar I have taken above code from <a href="https://stackoverflow.com/questions/27529610/call-function-based-on-argparse">here</a>.</p>