Considering your list of lords is in order, exactly as it appears in module_troops.py, without skipping any lords in between, you could use a loop to make the code shorter.
Python:
(store_add,":list_end",trp_knight_1_20,1),
(try_for_range,":lord","trp_knight_1_1",":list_end"),
(troop_set_slot,":lord",slot_lord_reputation_type,lrep_upstanding),
(try_end),
Variable ":list_end: is the last entry that loop will not reach, so it's your last troop on the list + 1 (that's why we do store_add +1 on it)
Loop goes through your list of lords, and on each repetition the current lord is stored to the variable ":lord" that we provided.
Then we just use 1 command, and executing it on ":lord". Because The loop puts 1 lord at a time into that variable and continues doing so until the end of the list, we only write 1 command, but it gets executed for all lords that get put into ":lord" by the loop.
Good luck with future coding! Loops are your friends
Also, you may wanna look into script "initialize_aristocracy" - that's where the game sets the lord personalities and other aristocracy related stuff.
The easiest solution would be to just insert your code at the bottom of that script in module_scripts.py.
So just look for "initialize_trade_routes" and go a bit up to the previous script block and that's where you want your code.
Keep in mind that according to my best knowledge this script is called only once, when new game is started.
But so is initialize_npcs, so you need to start a new game for this to appear in your game anyway.