Sending information about variable from blender game to another application

Hi,

First off, sorry if these questions appear a bit stupid. I have spent quite a few hours on google and trying out things myself, but with lack of experience, the things I find are very confusing.
I have worked with java for about a year, but never python or blender.

So here is the situation:
Me and a few others are assigned to a school project where we are going to make a snowboard simulator.
The snowboard is moving on a platform controled by 3 motors connected to PLC. The game we base this on is made in blender, I did not create the game myself.

The challenge is that I need to read the rotation of the snowboarder in the game, so that I can use that information to send signals to the PLC via a java application or something, telling it to move the platform in specific positions.

I have figured out the lines I need to type in python console on blender in order to get the variable I need, however I have not managed to create a server/client connection.

In order to get the rotation vector needed I type these lines:
snowboarder = bpy.data.objects[“Snowboarder”]
loc, rot, scale = snowboarder.matrix_world.decompose()
print(rot)

Based on my java knowledge, I assumed there would be a “main” method or a loop that I could put the server/client lines into, but I have not understood the way blender works, or if it even has a “main” method.

The game I’m using is available on github:

If anyone would take the time to help me out or guide me in the right direction, I would be very thankful.

Try using the module subprocess:

import subprocess

#CommandLine
Command =  "yourVariable as string"
        
#Path of the your file .exe
Executable = "c:\\myExecultable.exe"
        
#Seding the variable to your executable
subprocess.Popen(Command, -1, Executable)