I have two python files First python code in file 1:
import simpleT
def funcion():
print "Function called"
if __name__=="__main__":
try:
simpleT.Door().start()
while True:
time.sleep(1.5)
print "Main Op"
File 2(simpleT.py)
import threading
import time
class Door(threading.Thread):
def __init__ (self):
threading.Thread.__init__(self)
def run(self):
funcion()
Step 1:
I can execute the function if the class of thread is in the same file
Step 2:
I want split it, execute "function" localted on file 1 that containts the main function from the thread located on file 2 but error say:
NameError: global name "function" is not defined
how can i call this function?..is there super class or parameter required?
functionintosimpleT.pyinstead. This is BTW unrelated to threading.