Multiplayer - four gamepads, four players across two clients?

Hi there - hoping someone can help!
I’m starting my networking journey and working on adding online multiplayer to my game that currently supports two-player split-screen. I am having trouble assigning a specific gamepad to a specific player controller.
I have four gamepads connected to my PC, and I can run two instances of my game using the multiplayer settings (one server-listener + one client). I’m using the “-debugcreateplayer -1” command to spawn the second player in each window.
It works perfectly if I do this in a specific order (server gets a new player, then client), but it gets confused otherwise - sometimes two controllers will control the same pawn, sometimes the new controller is given a local ID of 0 instead of 1.
So my question is, is there a way to create a player controller for every gamepad connected to the PC and decide from there which one goes to which window?
And also this is only for development/testing purposes, but in a real-world example how is this handled? I can’t use a command to join in a second player.
Any info or resources are greatly appreciated, and thanks in advance!