Ashton> How do i make an option passed through command line, using
    Ashton> optparse global. I need to import this value in another file.

Place the parser's output at the module scope.

    global options
    parser = OptionParser()
    parser.add_option("-p", "--port", dest="port", default=5007,
                      type="int",
                      help="port to connect to for remote interpreter")
    ...
    options, args = parser.parse_args()

The user of your module can then execute

    from othermodule import options
    print options.port

Skip
-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to