In 1919, he was appointed tutor of thirteen-year-old Puyi who still lived inside the Forbidden City in Beijing as a non-sovereign monarch. As the Scottish-born tutor to the Dragon Emperor, Johnston and Isabel Ingram, daughter of an American missionary and the empress's tutor, were the only foreigners in history to be allowed inside the inner court of the Qing Dynasty. Johnston carried high imperial titles and lived in both the Forbidden City and the New Summer Palace. Johnston met the Ming dynasty Imperial descendant, the Marquis of Extended Grace Zhu Yuxun and arranged for him to meet Puyi in the Forbidden City. After Puyi was expelled from the Forbidden City in 1924, Johnston served as Secretary to the British China Indemnity Commission. In 1927, he was appointed the second civilian Commissioner at Weihaiwei. He ran the territory until it was returned to the Republic of China on 1 October 1930.
After China
Johnston was appointed Professor of Chinese in the University of London in 1931, a post based at the School of Oriental and African Studies, to which he bequeathed his library in 1935. This library, one of the finest collections of Chinese and East Asian books in the country, consists of over 16,000 volumes. He retained his ties with Puyi, which proved an embarrassment after the former emperor assumed the throne of the Japanese puppet state of Manchukuo. Johnston retired in 1937, having acquired the small island of Eilean Righ in Loch Craignish, Scotland, on which he created for himself a Chinese Garden and flew the flag of Manchukuo. After a short illness, he died in Edinburgh. In his will, he requested that no religious ceremony be conducted. In accordance with his wishes, he was cremated. His ashes were scattered on the island of Eilean Righ and surrounding Loch. He never married but was at one stage engaged to the historian Eileen Power, and was close to author Stella Benson. Mrs Elizabeth Sparshott, to whom he was engaged at the time leading up to his death, burned many of his letters and other materials, at Johnston's request. Johnston's book Twilight in the Forbidden City describes his experiences in Beijing and was used as a source for Bernardo Bertolucci's film dramatization of Puyi's life The Last Emperor. He was portrayed by Peter O'Toole in the film.