It would depend on how their particular immunity worked, really. Where's it from?
Because unless there's some other provision, the answer would be no, they would not be immune. Reason being that if the themselves cast Spell X, it's their spell, they're immune. If an item they created (a wand, say) casts it, they would not be immune - they're not casting Spell X, the wand is.
It would be like if they taught someone else a spell, and then that student cast it on them.