UR robot default script to run with Variable values from External python script

How do i run polyscope default program remotely with variables send to polyscope program from external python code running on host ( PC/raspberry pi).

I tried looking online material but could not find way to run default polyscope script on robot.

chouguleprasad9,
you need to use the Dashboard server port 29999

https://www.universal-robots.com/articles/ur/dashboard-server-e-series-port-29999/
It has examples of python code you can download to help you.

Hi i am more looking to run throw external python script from external pc. in your suggestion it shows example how to run throw socket test software. this is ok with testing purpose. For production environment, external python script is better as it has realtime variables to be sent to robot script .urp .

If your looking to send commands over TCP/IP then you should use primary of secondary port
see Overview of client interfaces - 21744 and Remote Control Via TCP/IP - 16496 for more details

you will still need the dashboard server for
Loading and playing programs
powering on and brake release
querying robot status
setting operational mode

your python code will need to read and write to port 29999 for dashboard commands
and port 30001 for script commands.