Error:"module" is disabled in this context

No, you’ll have to create a new HTML + HubL file, then copy-paste your code and edit the HubL variables e.g. replace something like {{module.title}} with {{title}} and make sure all variables are passed as arguments to the macro

{% macro myMacro(title, btn_text, btn_url) -%}
<div class="foo">
 <h1>{{title}}</h1>
 <a href="{{btn_url}}">{{btn_text}}</a>
</div>
{%- endmacro %}

Then use the macro in a module like so with the module variables in the relevant positions in the arguments list.

{% from '[macro url]' import myMacro %}
{{ myMacro(module.title, module.btn_text, module.btn_url) }}