title: python argparse having multiple subparsers in one commandline
body: <p>I am trying to parse multiple groups of arguments in one command line.
  both setup1 and setup2 can have identical arguments</p>
  <pre><code>python3 setup1 --param1 1 --param2 0 setup2 --param1 0 --param2 -1
  </code></pre>
  <p>I tried to use the subparse as below, but it appears it can be used for only one set of subparameters at a time.</p>
  <p>does anyone have any hint on how I could do this?</p>
  <pre><code>import argparse
  import sys
  
  def do_parse_args(argv):
      parser = argparse.ArgumentParser(description='Multiple subparsers')
  
      subparsers = parser.add_subparsers(dest='command')
      setup1 = subparsers.add_parser('setup1', help='parameters for setup1')
      setup1.add_argument(
          '--param1',
          action='store'
      )
  
      setup1.add_argument(
          '--param2',
          action='store'
      )
  
      setup2 = subparsers.add_parser('setup2', help='parameters for setup2')
      setup2.add_argument(
          '--param1',
          action='store'
      )
  
      setup2.add_argument(
          '--param2',
          action='store'
      )
  
      return parser.parse_args(argv)
  
  
  def main(argv=None):
      args = do_parse_args(argv)
      ret = 0
  
      print(args)
  
      return ret
  
  
  if __name__ == &quot;__main__&quot;:
      sys.exit(main())
  </code></pre>
  
  <pre><code>(venv_cvaas) C:\Work\python_hello&gt;python hello.py setup2 --param1 1 setup1 --param1 1
  usage: hello.py [-h] {setup1,setup2} ...
  hello.py: error: unrecognized arguments: setup1
  
  (venv_cvaas) C:\Work\python_hello&gt;python hello.py setup1 --param1 1 setup2 --param2 0
  usage: hello.py [-h] {setup1,setup2} ...
  hello.py: error: unrecognized arguments: setup2
  </code></pre>