Condition logic not working with mouse clicks

OS (e.g. Win10): Sonoma 14.6
PsychoPy version (e.g. 1.84.x): 2023.2.3
Standard Standalone? (y/n) yes (I think)
**What are you trying to achieve?: Conditional logic into loop 1 or 2 based on mouse click response.

What did you try to make it work?: The code and flow I currently have only works with key response (pre_key) in the Pre_trial routine (see first image). When using mouse click (see second image), the problem is the following: Target trials + L response = correct routine displayed (loop V2), Control trials + R response = correct routine displayed (loop V1) but in both opposite responses (Target + R or Control + L), the trial routine (either trialV1 or trialV2) is skipped and the feedback routine is displayed instead. This is the case 99% of the times, but sometimes a Target trials will correctly display the trial routine after responding R and vice versa.

As mentioned, when using key responses in the Pre_trial routine, and the code below, everything works fine. I suspect it is a problem with the mouse clicks not being properly reset or calibrated after each trial. The mouse is also always present on the screen, whereas I’d like it to be reset to the center of the screen for every trial.

Version with key press:

CondLogic_code:
(in End Routine)

if pre_key.keys == 'left' and TrialType == 'Control':
    V2Condition = 0
    V1Condition = 1
elif pre_key.keys == 'right' and TrialType == 'Control':
    V2Condition = 1
    V1Condition = 0

if pre_key.keys == 'left' and TrialType == 'Target':
    V2Condition = 1
    V1Condition = 0
elif pre_key.keys == 'right' and TrialType == 'Target':
    V2Condition = 0
    V1Condition = 1

Version with mouse click (that I am trying to get to work)

Where pre_mouse has clickable stimuli L and R (both images) and end routine in valid click
and CondLogic_code is:
(in End Routine)

if pre_mouse.clicked_name == ['L'] and TrialType == 'Target':
    V2Condition = 1
    V1Condition = 0
elif pre_mouse.clicked_name == ['L'] and TrialType == 'Control':
    V2Condition = 0
    V1Condition = 1
else:
    if TrialType == 'Target':
        V2Condition = 0
        V1Condition = 1
    elif TrialType == 'Control':
        V2Condition = 1
        V1Condition = 0

Any help is appreciated.