One approach that I have used for similar purposes is to generate the appropriate header files (or module or whatever) from a simple text file for all the required uses.
Since you already know python this should be pretty easy. Quick "proof of concept" follows. (Warning: I barely know any python.)
One downside to this is that you have to remember to regenerate the header/module each time you update the enum (keys or values) - don't forget to recompile for the C++ part. If you have a build system, it is best to integrate that code generation step into it.
A variation of this is to parse one of the language's source code to extract the definition and output it in a format suitable for the other. That is generally much harder to do though if you want to make it robust.
robot.enum
UP 1
DOWN 2
LEFT 3
RIGHT 4
JUMP 5
enum_generator.py
def python_enum(filename):
with open(filename, 'w') as w:
w.write('class Robot(Enum):\n')
with open('robot.enum') as r:
for line in r:
parts = line.split()
w.write(f' {parts[0]} = {parts[1]}\n')
def cplusplus_enum(filename):
with open(filename, 'w') as w:
w.write('#pragma once\n')
w.write('enum Robot: int {\n')
with open('robot.enum') as f:
for line in f:
parts = line.split()
w.write(f' {parts[0]} = {parts[1]},\n')
w.write('};');
python_enum('robot_enum.py')
cplusplus_enum('robot_enum.h')