How to execute IN APP written methods


There are few components in my app which are developed using OpenGL and so it appears as image in automation tools. We have written few methods in application code itself (Android/iOS) and call them when those components appears in test flows.
Can we do the same using Appium? Which methods will help us in that?

Reference: Something like someDriver.runNativeMethods(“Methods written in app code”);