This is not functionality the ur_modern_driver
provides. The driver is not a bridge into the VM that runs your URScript on the controller, but interfaces with the external motion and input/output capabilities of the controller.
A typical ROS approach would be to either use the services provided by MoveIt (if you're using MoveIt already, see Kinematic Model Tutorial for instance), or load an IK plugin directly into your application / script and use that.
trac_ik
was recently extended with Python wrappers, see wiki/trac_ik. You could perhaps use that.
Another alternative could be KDL. There are both C++ and Python interfaces to that available, see wiki/orocos_kinematics_dynamics. Note that this may be slightly involved to get working, as it doesn't seem to have been updated much over the past few years.