Python: using either command line or import
<pre><code>def nearbin():
    parser = argparse.ArgumentParser(description = "choose near bin")
    parser.add_argument("-bin",  type=int,action = "store", default = "10", help="bin number")   
    args = parser.parse_args()   
    bin = args.bin 
    print bin
    return f(bin)


if __name__ == "__main__":
    nearbin()        
</code></pre>

<p>In command line, I can use "python test.py -bin 10" to run the program</p>

<p>If I want to <code>import test</code> in another python script and use function <code>nearbin(bin)</code> in another script, how can I do this?</p>
