AttributeError when calling len of model
This looks like some issue with your debugger / pycharm. The `__len__()` / `count` behavior is covered by unit tests. `peewee.fn` is an instance of `Function` and implements some magic -- possibly your debugger is shadowing the `fn` name. Not sure. I think that must be something to do with it. I tried renaming global 'fn' to 'fn_p' in peewee.py and it succeeded, so it does seem to being overwritten. I've tried tracing this through a bit and it seems that during the initialisation of the `SqliteExtDatabase` the registering of the cython rank functions results in the global fn being overwritten. I cannot understand how this would be happening. 
I'm getting an AttributeError when I call len on my Model class. Weirdly this occurs when I run a test in the pycharm debugger but not when I run the same test outside the debugger. 

Python Version 3.10.4
Peewee Version 3.15.1

```
../../src/stores/fs.py:79: in rows
    return len(self.model)
../../venv/lib/python3.10/site-packages/peewee.py:6366: in __len__
    return self.select().count()
../../venv/lib/python3.10/site-packages/peewee.py:1931: in inner
    return method(self, database, *args, **kwargs)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

self = <peewee.ModelSelect object at 0x1112fdf30>
database = <playhouse.apsw_ext.APSWDatabase object at 0x10f42bb50>
clear_limit = False

    @database_required
    def count(self, database, clear_limit=False):
        clone = self.order_by().alias('_wrapped')
        if clear_limit:
            clone._limit = clone._offset = None
        try:
            if clone._having is None and clone._group_by is None and \
               clone._windows is None and clone._distinct is None and \
               clone._simple_distinct is not True:
                clone = clone.select(SQL('1'))
        except AttributeError:
            print("AttributeError")
            pass
        print(f"2211 peewee - {fn.__name__}")
        print(dir(fn))
>       return Select([clone], [fn.COUNT(SQL('1'))]).scalar(database)
E       AttributeError: 'builtin_function_or_method' object has no attribute 'COUNT'

../../venv/lib/python3.10/site-packages/peewee.py:2214: AttributeError
```

Instead of calling `len(model)` I am successfully able to run `len(model.select())` but `model.select().count()` raises the AttributeError. 

Not sure if this is helpful, but I tried putting a print message in the ModelSelect.count() function

```
print(f"2211 peewee - {fn.__name__}")
return Select([clone], [fn.COUNT(SQL('1'))]).scalar(database)
```

Which in failing debug mode outputs
```
2211 peewee - peewee_rank
```

Otherwise this outputs
```
2211 peewee - <function Function.__getattr__.<locals>.decorator at 0x1120352d0>
```

I can provide more info if needed.