Alter a panel page variant provided by another module (programmatically) How can I alter a panel page variant provided by another module in my own module?

I am using Advanced Forum, and it provides a panel page to override Drupal's core forum display behavior and some variants: Top Level Forum, Container and Forum. But I have changed some layout options, and added a few more panes, and disabled some other panes etc in page manager UI. Now I want to export this into code, i.e. in my custom module. I can export the code using the export option in the UI, but I don't know how to add that code in my module. In other words I don't know which hook to implement to override this variant provided by Advanced Forum, instead of creating my own variant.

I know how to provide default panel pages or variants using hook_ctools_plugin_api() and hook_ctools_plugin_directory(), but I couldn't find out how to alter an existing page variant provided by another module.

Is there a hook for that?
You might try creating a clone of this variant and then making your custom changes to it. You can then reorder this variant so it is above the original. This way your custom variant will always get executed and the original one ignored.

Once that is completed, you should then be able to export your variant using features.