I managed to solve it. The code works, my issue lay within the deployment of the contract. I was trying to deploy to an existing address, thinking it would change the contract's state but a contract is immutable. Hence the function did not even exist on that contract, which resulted in the errors.