Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

In this scenario, we configure a task for the Python language. In the Python file name field, you need to set which the Python file that will be to be executed. In this example, we used the Main2.py.

...

Code Block
import sys
from Extensions.TKDataAccess import TKDataAccess dataAccess = TKDataAccess()
connectionStatus = dataAccess.Connect("127.0.0.1:3101", "guest", "") print("Connection: " + connectionStatus)

if dataAccess.IsConnected() :
ret  =  dataAccess.GetObjectValue("Tag.tag1") print("Value: " + str(ret)) dataAccess.SetObjectValue("Tag.tag2",  ret)

dataAccess.Disconnect()


Then, in the your project, you need to create a code or a Python Script Task that executes the Main.py file, which contains the calling for TKDataAccess as showed shown above. So here, we will use the Python namespace as previously described.

...