Here's some fun with imports. When things get really sticky I add a startup function. --Darrell open("f1.py",'w').write(""" import f2 x=5 f2.startUp() f2.run() """) open("f2.py",'w').write(""" import sys def startUp(): import f1 sys.modules[__name__].__dict__['x']=f1.x def run(): print 'Run:', x """) import f1 # Also try running just f1.py