import M2 import pickle CC, KK, HH = M2.main() data_M2 = {'CC': CC,'KK': KK,'HH': HH} filename = "Res1212.bin" with open(filename, 'wb') as file: pickle.dump(data_M2, file)