Iterative word learning and testing paradigm with feedback. Once a word's definition is correctly answered twice, I need it to be removed from the learning set

If this template helps then use it. If not then just delete and start from scratch.

On a Mac Big Sur using PsychoPy v2022.1.3

Paradigm:
I am trying to create an iterative word learning paradigm. I will have 90 words that need to be learned. Not shown is a familiar task in which participants indicate whether or not one of the rare words is already familiar. If they answer that it isn’t familiar, the word and its definition are added to a learning_set that is called during the word learning and testing sessions. Durint testing,aA word will be considered learned once the participant correctly indicates the definition twice. I have this set up to be on a mouse click. Each time a participant answers I give conditional feedback of correct or incorrect based on where the mouse click is.
I have created the following word learning, testing, and feedback loops:

Following this discussion page:

I have been focused on getting the test and feedback to work correctly. Once I had done that, I thought I would copy/paste the usable code to get the learn routine to only show the unknown trials rather than all of the learned words.
So I have created a dictionary that is supposed to keep track of how many times each word in the learning_set is correctly answered.

I have written this code in the begin experiment tab on the test routine

scoreDict = {}
allData = data.importConditions(u'fam_2.xlsx')
for dl in allData:
    scoreDict[dl[u'word']] = 0

In the begin routine I have this

alreadyLearned = False
if scoreDict[word] >= 2:
    continueRoutine = False
    alreadyLearned = True

in each frame I have this

if def_resp.isPressedIn(corrDef):
    thisExp.addData('correct_testRT', t)
    thisExp.addData('correct_test', 1)
else: 
    thisExp.addData('correct_test', 0)

and in the end routine I have this

if alreadyLearned:
    test_trials.addData('correct_test', 'LEARNED')
elif def_resp.isPressedIn(corrDef)):
    scoreDict[word] += 1
else:
    scoreDict[word] += 0 

haveTrialsLeft = False
for word in scoreDict:
    if scoreDict[word] < 2:
        haveTrialsLeft = True
        break
if not haveTrialsLeft:
    test_trials.finished = True

and then I have added this to my feedback trial

if alreadyLearned:
    continueRoutine = False

Problem: When I do this, I don’t get an error. Instead, what happens is that once I get one of the answers to oen of the words correct, it prints learned for the rest of the words in that loop. So if I get the first word’s definition right, it won’t show me the other two words that I have included for learning. If I get the first word wrong, it will show me the next trial until I get one right.

So I think something is wrong with my scoreDict, but I’m not sure what since I followed the advice from the above post. I think it could also be about my placement of code, but I’ve tried a lot of options with no luck.

If someone could help me out that would be so great!

Okay I have an update. I made some changes to the code. I had already created a Learning_Set from a different loop that contained the words participants had indicated as unknow. In that Learning_Set I appended a column called learn_score. This started at 0 and then if participants got it right, I coded the column to add 1 as so:

if def_resp.isPressedIn(corrDef):
Learning_Set[test_trials.thisN][6] += 1
else: 
Learning_Set[test_trials.thisn][6] += 0

then I have code saying that alreadyLearned becomes TRUE when the learn_score becomes equal to 2:

if Learning_Set[test_trials.thisN][6] >= 2:
alreadyLearned = True 
if alreadyLearned = True:
countinueRoutine = False 

The continueRoutine = False is present in the test, feedback, and learn trials so that they don’t occur when the word is already learned.

The problem now is that if the first word in the learning set has been learned, the whole routine stops and doens’t show the not learned words. I feel like I am so close, but I’m not sure how to fix this problem.