A module is a file containing Python definitions and statements. The file name is the module name with the suffix .py

create hello.py then write the following function:

def helloworld():

print "hello"

>>> import hello

>>> hello.helloworld()

'hello'

>>>

To group many .py files put them in a folder. Any folder with an __init__.py is considered a module by python and you can call them a package

|-HelloModule

|_ __init__.py

|_ hellomodule.py

You can go about with the import statement on your module the usual way.

For more information:

http://docs.python.org/2/tutorial/modules.html#packages