You can't. Basically if you switch from layout A to layout B then layout A do not exist anymore. Everything on that layout (if not set to global) is destroyed and unloaded from memory.
"if my player presses the button to go to the main menu and then goes back to the game layout, then the functions are still active"
hard to tell without looking at your events, but this should not have happened. If you create a bullet (behavior ON by default) on game layout and set its behavior to OFF by some event then when you go to main menu this bullet don't exist anymore (if it's not set to global).
what you are saying here look like your player is a global object, and if that's true then you will need to manually reset all of his states, behaviors etc.