At one point during Wang Jian's reign, Yu Ningji became an imperial scholar (翰林學士, Hanlin Xueshi).[1] By 917, he was serving as the chief imperial scholar (翰林學士承旨). In the fall that year, the powerful eunuch Tang Wenyi (唐文扆) accused then-director of palace communications Mao Wenxi of overreaching, Wang Jian exiled Mao and replaced him with Yu on an acting basis. Later in the year, Wang Jian officially made Yu director of palace communications, and also made him the minister of civil service affairs (吏部尚書, Libu Shangshu). When Wang Jian became deathly ill in summer 918, Wang Jian, after exiling Tang after accusations by his adoptive son Wang Zongbi, whom he was intending to entrust his son and crown prince Wang Yan to, that Tang was intending to seize power, put Yu in charge of matters of finance, civil service, and justice, while putting the eunuch Song Guangsi in charge of military dispatches. Shortly before his death, he further made Song director of palace communications — while the historical records were silent as to whether, simultaneously, Yu remained as director of palace communications as well, or whether Yu was relieved of that post and only serving as minister of civil service affairs. After Wang Jian's subsequent death, Wang Yan took the throne as emperor. Wang Jian's last edict, naming the officials whom he entrusted the new, young emperor to, did not name Yu among the officials. (The ones named were Song and Wang Zongbi, as well as Wang Jian's other adoptive sons Wang Zongyao (王宗瑤), Wang Zongwan (王宗綰), and Wang Zongkui (王宗夔).)[2]