Is it possible to call custom code from a panel? My custom module has a function which returns some content. I wish to call this from my panel.
Here's a hackier/quicker solution.
Create a custom content pane using the PHP input format for the content area. Call your function.
You will not have simple access to panels contexts (which you may not need anyway), and must have the PHP input format enabled (which can potentially cause security problems).
You have access to the args, etc so you can pull nid from arg(1) if it's a node panel for example.
It is, but requires a bit of coding. You need to create a ctools content type plugin. I had the same issue a few months back, and found this to be a reasonably good guide for writing you r own content type:
There are also a couple other options:
Expose the data your function is providing in a block. Blocks are automatically supported by panels.
You could (likely) use custom PHP in a panels pane. (highly discouraged)