title: is there a way to clear python argparse?
body: <p>Consider the following script:</p>
  
  <pre><code>import argparse
  parser1 = argparse.ArgumentParser()
  parser1.add_argument('-a')
  args1 = parser1.parse_args()
  
  parser2 = argparse.ArgumentParser()
  parser2.add_argument('-b')
  args2 = parser2.parse_args()
  </code></pre>
  
  <p>I have several questions:</p>
  
  <ol>
  <li>Is parse_args a one-time method or is there a way to clear the
  arguments before adding new ones? (e.g. something like
  <code>args1.clear()</code> or <code>parser1.clear()</code>)</li>
  <li>The result of this script is unusable. Although this script accepts
  the <code>-a</code> argument, it does not accept any value for 'a'. Nor does it
  accept any <code>-b</code> argument. Is there some way to make any of the arguments really work?</li>
  <li>This is my actual scenario: I have 2 scripts. Both import the same
  file which has initialization code (load config files, create
  loggers, etc.), lets call it init.py This init.py file also parses
  the arguments only because it needs one value from it. The problem
  is that I need one of the scripts to accept other arguments as well.
  Since init.py does something with one argument, I cannot wait with
  parse_args. How can I make it work?</li>
  </ol>
  
  <p><strong>Edit:</strong></p>
  
  <p>Here is the output of my script:</p>
  
  <p>[prompt]# python2.7 myscript.py -a</p>
  
  <p>usage: a.py [-h] [-a A]</p>
  
  <p>myscript.py: error: argument -a: expected one argument</p>
  
  <p>[prompt]# python2.7 myscript.py -a 1</p>
  
  <p>Namespace(a='1')</p>
  
  <p>usage: a.py [-h] [-b B]</p>
  
  <p>myscript.py: error: unrecognized arguments: -a 1</p>