Related activity records for custom modules

Related activity records for custom modules

For default modules in CRM, whenever I create a task for a contact, the task also appears in the record for the parent account. How do I replicate this with custom modules?

My specific situation is that I have a custom module as a child module to Accounts. Ideally whenever I add an activity for a record in this custom module, the activity will also show up in the related list for its parent account.