import subprocess
import sys
from matplotlib import pyplot as plt

cmd = ["py","bestScript.py","data","150"]
#cmd =["ipconfig"]
p = subprocess.run(args= cmd,cwd="C:\\PROJECTS\\testAPI\\scripts", shell=True, text=True,capture_output=True)
print(p)
message = p.stdout.split("\n")
print("OKKOKOK")
print(message[0])
data = [float(x) for x in message[1].split(";")]
print(data)


cmd = ["py","bestScript.py","timebase","150"]
p2 = subprocess.run(args= cmd,cwd="C:\\PROJECTS\\testAPI\\scripts", shell=True, text=True,capture_output=True)
print(p2)
message = p2.stdout.split("\n")
print("OKKOKOK")
print(message[0])
timebase = [float(x) for x in message[1].split(";")]
print(timebase)

plot = plt.plot(timebase,data)
plt.show()
