Python-urx- Help controlling robot iq 2 finger gripper

Hi, I have a ur5e on polyscope 5.17 connected to a robotiq 2F gripper. I am trying to control this entire robot in python using GitHub - SintefManufacturing/python-urx: Python library to control a robot from 'Universal Robots' http://www.universal-robots.com/ . The controller is my pc and it is linked up via an ethernet cable. However, I have been really struggling to get the gripper to work. It is linked up fine and works fine in manual mode but not been able to control it with the code as shown below,

robot = urx.Robot(" ip adress of robot")
gripper = Robotiq_Two_Finger_Gripper(robot)
position = robot.get_pose()
position.pos.z += 0.1
robot.movel(position, acc=0.5, vel=0.2, wait=True)
gripper.close_gripper

can anyone help?

Hello

I control the robotiq 2F gripper with python through the USB port of the PC, which is where I connect the gripper.
The library I use is the one in the following code:

#from pyRobotiqGripper import RobotiqGripper as gripper

import pyRobotiqGripper

import time

gripper = pyRobotiqGripper.RobotiqGripper()

gripper.activate()

time.sleep (0.2)

gripper.close()

time.sleep (0.25)

gripper.open()

time.sleep (0.22)

gripper.goTo(150)

time.sleep (0.2)

gripper.goTo(100)

time.sleep (0.2)

gripper.goTo(50)

position_in_bit = gripper.getPosition()

print(position_in_bit)

gripper.printInfo()