title: How to share argparse arguments across python modules?
body: <p>arguments.py</p>
  
  <pre><code>import argparse
  
  args = None
  local_host = None
  
  
  def pass_arguments():
      global args, local_host
      parser = argparse.ArgumentParser()
      parser.add_argument("host", help="Host URL", type=str, default="https://example.com")
      args = parser.parse_args()
      local_host = args.host
  </code></pre>
  
  <p>main.py</p>
  
  <pre><code>from arguments import *
  
  pass_arguments()
  print args.host
  print local_host  # defined variable to simplify access
  </code></pre>
  
  <p>This results an error </p>
  
  <pre><code>    print args.host
  AttributeError: 'NoneType' object has no attribute 'host'
  </code></pre>
  
  <p>Alternatively, I could use
  main.py</p>
  
  <pre><code>import arguments
  
  arguments.pass_arguments()
  print arguments.args.host
  print arguments.local_host  # defined variable to simplify access
  </code></pre>
  
  <p>What is the best practice here?</p>