Answers.Body: <p>You have to import the macro </p>
  
  <pre><code>{# include the richtext macro on multiple occasion into another macro #}    
  {% macro memberMolecule( entryParam ) %}
      {% import _self as macro %}
      {{ macro.richText(entryParam.body) }}
  {% endmacro %}
  </code></pre>
  
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2018-04-10T08:12:56.987Z
Answers.LastActivityDate: 2018-04-10T08:12:56.987Z
Answers.UserDisplayName: Robin Schambach
Body: <p>This used to work in Craft 2:</p>
  
  <pre><code>{% macro richText(macroParam) %}
    {{ macroParam |striptags('&lt;br&gt;&lt;p&gt;&lt;li&gt;&lt;ul&gt;&lt;a&gt;&lt;strong&gt;&lt;i&gt;')|raw }}
  {% endmacro %}
  
  {# include the richtext macro on multiple occasion into another macro #}    
  {% macro memberMolecule( entryParam ) %}
    {{ _self.richText(entryParam.body) }}
  {% endmacro %}
  </code></pre>
  
  <p>Now in Craft 3 this causes the error: </p>
  
  <blockquote>
    <p>Impossible to invoke a method ("richText") on a string variable
    ("path/to/file/with/the/macro").</p>
  </blockquote>
  
  <p>How do I have to rewrite this for Craft 3?</p>
  
Tags: <craft3><migration>
Title: Macro _self no longer possible in Craft 3
ThreadText: # Macro _self no longer possible in Craft 3
  
  (Asked by: username_0 on 2018-04-10)
  
  This used to work in Craft 2:
  
  ```
  {% macro richText(macroParam) %}
    {{ macroParam |striptags('<br><p><li><ul><a><strong><i>')|raw }}
  {% endmacro %}
  
  {# include the richtext macro on multiple occasion into another macro #}    
  {% macro memberMolecule( entryParam ) %}
    {{ _self.richText(entryParam.body) }}
  {% endmacro %}
  
  ```
  
  Now in Craft 3 this causes the error:
  
  > Impossible to invoke a method ("richText") on a string variable
  > ("path/to/file/with/the/macro").
  
  How do I have to rewrite this for Craft 3?
  
  **Tags:** craft3, migration
  
  
  ---
  
  ## 1 answers
  
  ### Answer by username_1 on 2018-04-10. Score: 4 | Accepted answer
  
  You have to import the macro
  
  ```
  {# include the richtext macro on multiple occasion into another macro #}    
  {% macro memberMolecule( entryParam ) %}
      {% import _self as macro %}
      {{ macro.richText(entryParam.body) }}
  {% endmacro %}
  
  ```
  
  
  ---
  
  