A system and method for treating obesity including a first instrument containing a first magnet therein, the first instrument insertable into a stomach of a patient and the first magnet deployable into the stomach of the patient and having a first space. A second instrument contains a second magnet therein, the second instrument insertable into a bowel of a patient and the second magnet deployable into the bowel of the patient and having a second space. A stent is insertable into the first and second spaces to maintain an opening formed between the stomach and bowel.