As far as I know there is no option to directly connect Python code with the KRL code.
A possible workaround is to convert the variable in Python to a binary value and send this value via IO signals to the robot. Then convert the IO signals through a signal declaration in KRL back to an integer.