If your erection works perfectly in one setting but not in another, then the whole problem is likely to be in your head I.e. stress
related. Certainly different sexual partners can affect you differently. If you have the least bit of performance anxiety with a partner there is no doubt your erectile functions will suffer. This is nothing to worry about. The more experience you gain with a partner the better you will perform with them. It's all a question of practice and familiarity.