Workflow not triggering when record is created from function

Workflow not triggering when record is created from function

I have created a custom module (prospects) to copy required information from a lead to the prospect module. The reason for this is that I need to create a dashboard in Analytics to display all leads created in the day, week and month - when a lead is converted to an opportunity the lead is no longer seen by the dashboard. As a work around, everytime a lead is created, I have a workflow to trigger a function to copy the information over.

The problem is that I also need to update the prospect record if the lead is updated. I have created a second workflow and function to write the prospect ID back to the lead. However, the workflow is never triggered when the prospect record is created from the function. If I manually create a prospect and enter a valid LeadId, the lead is updated.

Is there a way to get this to work?