Are you navigating from one page to another? If that is the case, then you can't directly do. You have to create the instance of the MainPage and then you can call the public method:
MainPage mainPage = new MainPage();<br />
mainPage.DoCall();<br />
If your mainpage is still loaded in memory as the base page & on top of it if you are loading any UserControl then you can easily access it from the instance.
If this solves your problem, please "Mark As Answer", and if you are using some other mechanism to load one page from another, please elaborate the same. It will be easier for us to help you out.
Thank you for posting in CodeProject.