Typically, you'd put something like that in a separate file and import it whenever you needed it. Here's how your project directory structure might look:
# /home/your_user_name/PROJECT_DIR
# PROJECT_DIR/setup.py
# PROJECT_DIR/README.md
# PROJECT_DIR/your_app
# PROJECT_DIR/your_app/__init__.py # mark this folder as a python package named your_app
# PROJECT_DIR/your_app/main.py # your main codes
# PROJECT_DIR/your_app/utils.py # put stuff like help in here
So in utils.py:
def help():
ret = "calculating stuff to return"
return ret
And in main.py:
from your_app import utils
def run():
if option == 'help':
utils.help()
if __name__ == "__main__":
run()
Hope that helps!