I decided to come at this from a different angle.
If you are looking for an autocomplete feature based on a known list of strings, then could you take a simpler approach?
For example:
prefix='ri'
words=['peter', 'petrol', 'peewie', 'purdie',
'paul', 'mary', 'ringo', 'rant',
'ringer', 'pingo', 'dingo', 'go']
results=[x for x in words if x.startswith(prefix)]
#returns
['ringo', 'ringer']
Now we can extend that basic example into an Anvil app:
clone:
https://anvil.works/build#clone:LNKHIF7M7K4R4FH7=Y6RLNKHP5CWIXX77FOIWRNZ5
I hope this helps.