Error when using Query Engine API in plugin HomePage

I am trying to make a plugin where you can input a JSON file and update some records in the database, and have a button that runs a function. The function use strapi.db.query('api::{collection name}').findMany() to find existing records, to then update. I am doing this in the index.js of the HomePage folder.

I get the following error:

Uncaught (in promise) TypeError: Cannot read properties of undefined (reading 'query')
    at [request].6a2dc435.chunk.js:1:639
    at (<anonymous>)
    at i ([request].6a2dc435.chunk.js:1:268)