How to access db in prodigy 1.10

In prodigy 1.8.3 I used to access the database as follows:

    def choice(...):
        def on_load(ctrl):

But with 1.10 version I got
'NoneType' object has no attribute 'db'

That's strange – nothing around this should have changed and the on_load callback should get passed the instance of the Controller :thinking:

Anyway, the simplest solution (in general) is to just use the connect helper and connect to the database anywhere in your recipe:

from prodigy.components.db import connect

db = connect()