Cook the Onions: In a skillet over medium heat, melt 2 tablespoons of butter. Add the thinly sliced onions and cook, stirring occasionally, until they are caramelized and golden brown, about 15-20 minutes. Remove from skillet and set aside.
Form the Patties: Divide the ground beef into four equal portions and shape them into patties slightly larger than the slices of rye bread. Season both sides of each patty with salt and pepper.
Cook the Patties: In the same skillet over medium-high heat, melt the remaining 2 tablespoons of butter. Add the beef patties and cook for 3-4 minutes per side, or until they reach your desired level of doneness. During the last minute of cooking, place a slice of Swiss cheese on top of each patty to melt.
Assemble the Patty Melts: Meanwhile, lightly toast the slices of rye bread. Once toasted, place a slice of Swiss cheese on each slice of bread. Place a cooked beef patty on top of the cheese on four of the slices. Divide the caramelized onions evenly among the patties, then top each with another slice of bread, cheese side down.
Grill the Sandwiches: Return the assembled sandwiches to the skillet and cook over medium heat until the bread is golden brown and the cheese is melted, about 2-3 minutes per side. Press down gently with a spatula while cooking to help the cheese melt and the sandwich to crisp up.
Serve: Remove the patty melts from the skillet and slice them in half diagonally, if desired. Serve hot, with Thousand Island dressing or mustard on the side for dipping, if desired.