Imam Husain's (as) prior knowledge of his Shahadat

روي الطبراني قال: قال أبو جعفر: وحدثنا سفيان بن وكيع، عن أبيه وكيع، عن الأعمش، قال: سمعت أبا صالح التمار يقول: سمعت حذيفة يقول: سمعت الحسين بن على يقول: والله ليجتمعن على قتلى طغاة بني امية ويقدمهم عمر بن سعد وذلك في حياة النبي صلى الله عليه وآله. فقلت له أنبأك بهذا رسول الله ؟ قال (لا، فأتيت النبي فأخبرته، فقال علمي علمه، وعلمه علمي، وأنا لنعلم بالكائن قبل كينونته

Abu Jafar said, Narrated to me Sufyaan bin Waqea, from Al-Aamash. Who said, I heard Aba Saleh Al-Tammar saying, He heard from Huzaifa who said:

"I heard Al-Husain bin Ali  He said, "By Allah, the tyrants of Bani umayya (la) will gather for killing me and they will be lead by Umr bin Saad (la). And this incident happened in the life of the Prophet (saww).
I (Huzaifa) said to Imam Husain , "Did Prophet (saww) give the news of this to you?". Imam Husain  said, 'No'.
I (Huzaifa) then went to the Prophet (saww) and informed Him of what occurred.
Prophet Muhammad (saww) said, "My knowledge is His Knowledge and His knowledge is My Knowledge. And verily, We have the knowledge of things before they occur."

[Source: Dalaail Al-Imamah Pg.183-184]

This incident clearly shows that the Imam's (as) have knowledge bestowed by Allah (swt) from the very beginning and it is not that the Imam's (as) get knowledge only after they get the responsibilities of Imamat.