Once you are healed, and ready to commence rehabilitation, you might consult a physical therapist or a 'cardiac rehab' expert to see if and how to do it. My feeling is that if you start slow, stay acutely attuned to how your body reacts to the stresses you impose on it, take your pulse at the end of each set or series of reps, wait one minute, and then take it again to confirm it isn't staying high (you're looking for a reasonably fast recovery, so one full minute of inactivity should have your HR fall from a high by at least 15-20 BPM, even more), you will soon know if you're doing it 'right.' If nothing else, you need to build confidence again, to trust your repair, to trust your gut again, and also to go slowly enough that the strain isn't too great.
Please seek assistance from a qualified cardiac physician or surgeon and get some info, maybe a pamphlet to help you with this. There must also be good information from the internet if you do a search with syntax like, 'how to recommence weight training after having a pacemaker installed', or something along that line.
@gloaming
Thank you. It’s good advice.