# Sharing Macros between Modules?

**URL:** <https://community.hubspot.com/t/sharing-macros-between-modules/9921>\
**Category:** CMS Development\
**Created:** [August 21, 2018, 4:10pm UTC](https://community.hubspot.com/t/sharing-macros-between-modules/9921 "2018-08-21T16:10:01Z")\
**Posts on this page:** 1\
**Showing post:** 4

<div class="post-metadata">

**Author:** ![andre9000](https://d10pqhm3lwygmk.cloudfront.net/user_avatar/community.hubspot.com/andre9000/32/53869_2.png) [@andre9000](https://community.hubspot.com/u/andre9000)\
**Post date:** [November 26, 2018, 4:44pm UTC](https://community.hubspot.com/t/sharing-macros-between-modules/9921/4 "2018-11-26T16:44:01Z")

</div>

Actually it seems possible now. If you have a design you want to reuse, you can make it a macro that you import to other modules.

Example macro.html:

```auto
{% macro bar(heading, subheading) %}
<h1>{{ heading }}</h1><p>{{ subheading }}</p>
{% endmacro %}

```

Example module.html:

```auto
{% import "Custom/macros.html" as foo %}

<div>
some content goes here
{{ foo.bar(module.heading, module.subheading) }}
</div>

```

--------------------------

If you want to avoid passing countless parameters to the macro, you can also do it like this:

Example macro.html:

```auto
{% macro bar(obj) %}
<h1>{{ obj.heading }}</h1><p>{{ obj.subheading }}</p>
{% endmacro %}

```

Example module.html:

```auto
{% import "Custom/macros.html" as foo %}

<div>
some content goes here
{{ foo.bar(module.heading_and_subheading) }}
</div>

```

‘heading\_and\_subheading’ would be a group in the module that contains ‘heading’ and ‘subheading’. You pass that group directly to the macro.

You’d just need to enforce standards in naming accross the different modules that use that macro.

Note I tested this with Email modules, not page modules.

---

_[View the full topic](https://community.hubspot.com/t/sharing-macros-between-modules/9921)._
