a.py:
Code:
def dummy1():
print "Hello"
b.py:
Code:
def dummy2():
print "world"
c.py:
Code:
if __name__ == '__main__':
from a import dummy1
from b import dummy2
dummy1()
print '----'
dummy2()
running python c.py will do what you want.
http://docs.python.org/release/2.6.6...l/modules.html
usualy you need to be sure that import didn't fail and use exception but probably this will be later when you will feel confortable enought with python.
Edit: two things:
- change url to point to your python version instead of 2.6.6
- i assume you don't ask about something like call, eval, exec( see the docs for details)
best regards