XML map with Python or Lua scripting

I have a UE4 game that loads XML map files. I want the XML map files to support Python scripts that enable map-specific game logic. This is for a board game simulation of HeroQuest (Milton Bradley, Games Workshop) (1989-1997). If it’s easier to do in a different language, such as Lua, that’s fine.

How do I go about this? I think I need some way to embed Python (or Lua) into my UE4 game. Then when my UE4 game loads an XML map, it will see , and have a hook to run foo.py. foo.py will interact with my UE4 game’s state (somehow).

The Python or Lua script doesn’t need an interface to UE4 objects. It just needs an interface to functions (and state) that I can expose to let it interact with board game state. Such as telling a monster to move. Or giving treasure to the heroes. Or triggering a trap that damages the heroes. Or display some quest text.

In fact, I don’t want the Python (or Lua) code to be tied to UE4 specifically. That way, the XML files could theoretically be used for a non-UE4 implementation of the game, as long as it implements the same interface to interact with the board game.