How to organize your custom code and import personal libraries

I don’t know if I’m the only one who sees this as a problem, but the fact that you can’t import your own library in a custom code block forces you to copy and paste snippets from one workflow to another.

To get around this limitation, I wrote a Python package (hubspot-py-preprocessor) that resolves import dependencies and inserts the corresponding code into the “main” file.

This allows me to use VS Code (my almost favorite IDE) to create reusable libraries, write my custom code using those libraries, and then generate the code to import into HubSpot.

You can find the project here: David BRAHIM / Hubspot Py Preprocessor · GitLab
And examples of how to use it here: David BRAHIM / hubspot-py-preprocessor-examples · GitLab

I look forward to hearing your feedback, opinions, and ideas for improvement.

Thanks for sharing! – Jaycee

Hubspot-py-preprocessor is also on pypi : Client Challenge