Make sure you have actually enabled it in module_scripts.
(assign, "$g_enable_custom_directional_keys", 0), #set to 1 to enable custom actions on directional keys
As you can see its only for singleplayer
get_player_agent_no = 1700 # (get_player_agent_no, <destination>),
# Retrieves the reference to the player-controlled agent. Singleplayer mode only.
Use the following instead
player_get_agent_id = 406 # (player_get_agent_id, <destination>, <player_id>),
# Retrieves player's current agent reference. Returns a negative value if player has no agent.
I suggest you use this for reference: https://forums.taleworlds.com/index.php/topic,213060.0.html