title: How do I pass variables to other methods using Python's click (Command Line Interface Creation Kit) package
body: <p>I know it's new, but I like the look of <a href="http://click.pocoo.org/" rel="noreferrer">click</a> a lot and would love to use it, but I can't work out how to pass variables from the main method to other methods. Am I using it incorrectly, or is this functionality just not available yet? Seems pretty fundamental, so I'm sure it will be in there, but this things only been out a <a href="https://github.com/mitsuhiko/click" rel="noreferrer">little while</a> so maybe not.</p>
  
  <pre><code>import click
  
  @click.option('--username', default='', help='Username')
  @click.option('--password', default='', help='Password')
  @click.group()
  def main(**kwargs):
      print("This method has these arguments: " + str(kwargs))
  
  
  @main.command('do_thingy')
  def do_thing(**kwargs):
      print("This method has these arguments: " + str(kwargs))
  
  
  @main.command('do_y')
  def y(**kwargs):
      print("This method has these arguments: " + str(kwargs))
  
  
  @main.command('do_x')
  def x(**kwargs):
      print("This method has these arguments: " + str(kwargs))
  
  
  main()
  </code></pre>
  
  <p>So my question is, how do I get the username and password options to be available to the other methods</p>