Hakim al Umma Mawlana Ashraf Ali Thanawi (Allah have mercy on him) said,
‘If an individual with correct intention stayed in the service of a Shaikh for considerable duration but did not find any influence (ta’seer) in his company than he should seek his objective at another place. This is because the objective is Allah not the Shaikh.
However, one should not have bad belief about the first Shaikh. It is possible that he is perfect and accomplished but one’s share was not there.
Similarly, if the Shaikh dies before the objective is achieved or it is impossible to meet him then one should seek another Shaikh. The thought of benefiting from his grave being sufficient and no need for another living Shaikh must not be entertained . This is because the benefiting from the grave is not for instruction (and guidance), only a sahib e nisbet can benefit, resulting in progress of his state (Ahwal). Whereas, this individual is still in need of instruction. Moreover, if this was the case (that benefiting from grave of pious was enough) then there would be no need of bayiah (taking another Shaikh). There are millions of graves of perfect Shuyukh and even Prophets (to benefit from in the world).
Taleemud Deen, page 125