Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

Use the 'import' statement.

For example, if I have prog1.py that contains:

print 'test 1'

and I run prog2.py which contains:

import prog1
print 'test 2'

My output would be:

test 1

test 2

Use the 'import' statement.

For example, if I have prog1.py that contains:

print 'test 1'

and I run prog2.py which contains:

import prog1
print 'test 2'

My output would be:

test 1

test 2

Importing a module or another program will automatically execute that program upon import.