Page Tree
Other Releases
...
The Python code using the TKDataAccess.py module in Main.py is described below:
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, you need to create a the code that is shown below or create a Python Script Task that executes the Main.py file, which contains the calling for TKDataAccess shown above. So here, we will use the Python namespace as previously described.
...