Recovering from a heart attack can take time and needs to be well documented to assure the FAA that the significant risk to flight has passed. With that properly done, and with a full recovery, there is no reason you can’t return to flying either professionally or for fun.