Papal faction modding (M2TW)
If the papal_faction is used in M2TW there are two alternative ways of arranging a replacement for a dead pope.
Choice by College of Cardinals
The College can only be populated by priest agents with piety above the threshold set in the campaign_db.xml to reach 'cardinal' level.
The Pope will be chosen, by voting of the catholic factions, from amongst the priest agents in the college. The selected priest will disappear from the owning factions' roster and appear as a general with his original priest portrait, but a new name, in the papal_faction's capital.
Even if all the priests in the college are controlled by the same AI faction it doesn't seem as though there is a trait-based way of controlling who gets promoted to Pope.
Attempting to control the attributes of spawned priest agents who would qualify for the college (who don't start in descr_strat) is limited by spawn_character not allowing labels or custom portraits. Spawning a priest via spawn_army, which does allow those variables, is limited by the priest being killed when the game is reloaded, this causes a crash if the priest is adopted into the college and the player quits and reloads on the turn that the vote should be resolved.
Spawned Army with Empty College
If not priests are qualified as cardinals and the college is empty, and the Pope dies, the papal_faction can continue without a faction leader and without a pope in place, apparently indefinitely.
A named_character spawned via spawn_army whilst the college and Pope position are empty will become pope. That character will retain his portrait, label and first name.