Send UR Script commands via sockets in Python

Hi all,

I want to send UR Script commands via sockets using Python to control my VG10 gripper tool remotely.
My code is shown in the next picture:

This script does nothing in the robot until the moveJ command, which is well executed. But I would like to send the vg10_grip() and vg10_release() commands with some parameters. I have proved these script commands in teachpendant to check if the robot can perform them. For that purpose, I have made the following robot program with vg10_grip() and vg10_release() commands, and when executing, the robot executes the program with no problem.

I’m not sure if it is possible to send these script commands for controlling the tool via sockets. But I need to do something similar, because controlling the tool using digital outputs doesn’t allow me to specify the vacuum level to achieve.

If any of you has any ideas, I would be so grateful.

Thank you in advance.