As various others have already pointed out you can add the shebang to the top of your file
#!/usr/bin/python
or #!/usr/bin/env python
and add execution permissions chmod +x program.py
allowing you to run your module with ./program.py
Another option is to install it the pythonic way with setuptools. Create yourself a setup.py and put this in it:
from setuptools import setup
setup(
name = 'Program',
version = '0.1',
description = 'An example of an installable program',
author = 'ghickman',
url = '',
license = 'MIT',
packages = ['program'],
entry_points = {'console_scripts': ['prog = program.program',],},
)
This assumes you've got a package called program and within that, a file called program.py with a method called main(). To install this way run setup.py like this
python setup.py install
This will install it to your platforms site-packages directory and create a console script called prog. You can then run prog
from your terminal.
A good resource for more information on setup.py is this site: http://mxm-mad-science.blogspot.com/2008/02/python-eggs-simple-introduction.html