You can not create a class like this.
If want want place funcrion in class look at
Make no sense here so just remove the class.
Also to check that it works the time should be around 5-sec and not 10-sec.
If want want place funcrion in class look at
@staticmethod
.Make no sense here so just remove the class.
Also to check that it works the time should be around 5-sec and not 10-sec.
# th.py import threading from time import sleep def create_checksum(path): sleep(5) print("checksum Created") def create_gzip(path): sleep(5) print("gzip_Created") def main(): path = "d:\\output\\abc.csv" # Call Checksum Function to generate Checksum no t1 = threading.Thread(target=create_checksum, args=(path,)) t2 = threading.Thread(target=create_gzip, args=(path,)) t1.start() t2.start() t1.join() t2.join() # both threads completely executed print("Done!") if __name__ == "__main__": main()
Output:=== python th.py ===
checksum Created
gzip_Created
Done!
Execution time: 5.228 s