Error in page.update:after hook

I am getting an error in a page.update:after hook, triggered by this line of code:

$schools = kirby()->pages()->template('school')->filterBy('schoolType', $schoolType);

The error is:

Exception: Error
Call to undefined method Kirby\Cms\App::pages()

I am not sure what to try to fix this, does anyone have any thoughts?

There is no $kirby->pages() method, you can use site()->pages() instead.

Aha - yes that makes sense :sweat_smile:
Thank you!