Al-Kāfi

Hadith 988
twelve-imamswilayah
4ـ مُحَمَّدُ بْنُ يَحْيَى عَنْ مُحَمَّدِ بْنِ الْحُسَيْنِ عَنْ صَفْوَانَ قَالَ قُلْتُ لِلرِّضَا (عَلَيْهِ السَّلام) أَخْبِرْنِي عَنِ الامَامِ مَتَى يَعْلَمُ أَنَّهُ إِمَامٌ حِينَ يَبْلُغُهُ أَنَّ صَاحِبَهُ قَدْ مَضَى أَوْ حِينَ يَمْضِي مِثْلَ أَبِي الْحَسَنِ قُبِضَ بِبَغْدَادَ وَأَنْتَ هَاهُنَا قَالَ يَعْلَمُ ذَلِكَ حِينَ يَمْضِي صَاحِبُهُ قُلْتُ بِأَيِّ شَيْ‏ءٍ قَالَ يُلْهِمُهُ الله.
4. Muhammad ibn Yahya has narrated from al-Husayn from Safwan who has said the following. “I requested abu al-Hassan al-Rida (a.s.), ‘Enlighten me when an Imam comesto know that he is the Imam (a.s.)? Does it take place when the preceding Imam has already passes away or when he is about to leave this world? For example abu al-Hassan (a.s.) passed away in Baghdad and you were here (in the city of Madina)?” The Imam (a.s.) said, “He comes to know it at the time his companion (the preceding Imam) is about to leave this world.” I then asked, “By what means does he come to know it?” He said, “He comes to know it through inspiration from Allah.”
Source: Shaykh Muḥammad b. Yaʿqūb al-Kulaynī