Monitoring MIDI while recording

Quick question- when recording midi parts ( using DIN) i can only hear the midi instrument if its connected to the “thru” port while recording a take and then after recording the part i need the midi instrument to be connected to the “out”
How do i set it up in settings to not need to change from the thru/out ports?
thanks