Second monitor not detected after login

When I log into my desktop session, the second monitor does not appear, and I have to run kscreen-doctor output.DP-2.enable to get the monitor to appear in the display and monitor settings. Then I have to change the layout so the screen aren’t stacked on top of each other. Doing this on every login is annoying, so is there something I can do to fix the issue? I’m using Wayland on an Nvidia GPU with proprietary drivers. The monitor appears fine on the login screen.