gen-set 4000
The way to bypass an oil pressure switch depends upon how it works. It probably closes when the oil pressure rises and most likely provices a ground to a signal line. If that is what happens it will have only one wire to it and it will measure open, or infinity or near that when the engine is not running and it will go to near 0 ohms when the engine starts to run. That can be checked with a meter. It could be the oposite way also and open when the pressure comes up. But you need to know which. Closing is much more common. Assuming that it closes and has only one lead, then all that you do to simulate the operation is to ground the wire. If it opens, all that you do is to disconnect the wire. It could have two leads and then you would either short them together, if not shorted with engine not running or seperate then if they are shorted with the engine running. But most use a single wire.
You didn't say what make of genset or model you have. If it happens to be an Onan, it could be that you are not generating a voltage for some reason. Onans do stop running as soon as the start switch is released if they don't genrate power.
You can spend a lot of money buying parts if you are going to just randomly change parts to see if they help. It might be less expensive to pay a qualified tech to do the work and only pay for one part?