title: How to pass an arbitrary argument to Flask through app.run()?
body: <p>I would like to pass an object to a newly initiated flask app. I tried following the solution from the question: <a href="https://stackoverflow.com/questions/41264425/how-can-i-make-command-line-arguments-visible-to-flask-routes">how-can-i-make-command-line-arguments-visible-to-flask-routes</a></p>
  
  <p><strong>Edit</strong></p>
  
  <p>I would like to take a value that I pick up from initiating the python script from the command line.</p>
  
  <p>ie. </p>
  
  <pre><code>$ run python flaskTest.py -a goo
  </code></pre>
  
  <p>I am not seeing the difference between this and the solution to the question I am trying to replicate.
  <strong>Edit</strong></p>
  
  <p>Thus, I tried the following:</p>
  
  <pre><code>from flask import Flask
  
  app = Flask(__name__)
  
  print('Passed item: ', app.config.get('foo'))
  
  if __name__ == '__main__':
    from argparse import ArgumentParser
  
    parser = ArgumentParser()
    parser.add_argument('-a')
    args = parser.parse_args()
    val = args.a
  
    app.config['foo'] = val
    app.run()
  </code></pre>
  
  <p>Hoping to get the result...</p>
  
  <pre><code>'Passed item: Goo'
  </code></pre>
  
  <p>Is there a method for passing an arbitrary object through the initialization with app.run()?</p>