I am often contacted by students who have trouble staying in character or being nervous when on stage. It sounds to me as though this is just a matter of imagination and concentration. Whenever an actor is acting with someone in a class scene or audition or in a play or film, the first thing they have to do is accept the circumstances of the play--where it takes place, when it takes place, who they are and who the other people are. This is an exercise in imagination.
You must make-believe that the circumstances are true and you are this person in them. I advise taking a moment before doing any acting to switch on your imagination just as you do at home when you are imagining you are on stage or that your life is a movie. Wm Esper calls this daydreaming. It is a good way of looking at it. Harrison Ford says that when ever he acts, he says to himself, "OK, Let's pretend." He means that he is going to accept the circumstances of the scene as real-at least in his imagination. This is what you must do to be effective as an actor.
Second, staying out of your head will keep you from being nervous and allow you to focus on the scene. It is simply a matter of concentration and listening. You have to be completely focused on the scene and what is happening in it. You 'listen' with all of your senses to fully be immersed and so you will react fully and emotionally to the scene. If you have an audience and you are thinking of being in front of them, you are focusing on the wrong thing. You are focusing on you being an actor in front of an audience when you should be focusing on being in the scene.
It is concentration that allows you to focus on the proper things and eliminate those you should not be thinking about. Concentration is hard work. You have to make yourself do it and keep doing it without taking a break. That is what makes a performance without any breaks in it. When concentration is broken, actors often forget their lines or call other characters in the scene by the wrong name. This is one reason why stage acting is such good training for film actors
It takes a great deal of imagination and concentration to be an effective actor. . I hope this brief explanation is helpful to you and that you will start having more success being effective in your performances. God bless, Doc