That’s a great question asked by the Beis Yosef regarding the story with the Chossid (Y.D. 179/13). He answers that the issur is only if one fasts and then sleeps there with the intent of connecting to the niftar, something which this Chossid did not do. He adds, that perhaps he just ‘overheard’ their conversation, but was not intending to. The first point can be applied to Shmuel as well.
Rebbe,
How could Shmuel contact his father from olam haba? Isn’t there a chashash of doreish etzel hameis?
That’s a great question asked by the Beis Yosef regarding the story with the Chossid (Y.D. 179/13). He answers that the issur is only if one fasts and then sleeps there with the intent of connecting to the niftar, something which this Chossid did not do. He adds, that perhaps he just ‘overheard’ their conversation, but was not intending to. The first point can be applied to Shmuel as well.