Answers.Body: <p><a href="https://craftcms.stackexchange.com/a/9695/57">carlcs</a> is correct (as usual).</p>
  
  <p>You can only have one variable class that maps to <code>craft.pluginName</code>, but you can have methods inside that class that map to other variable classes.</p>
  
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2015-05-12T17:56:35.653Z
Answers.LastActivityDate: 2015-05-12T17:56:35.653Z
Answers.LastEditDate: 2017-04-13T12:51:00.200Z
Answers.UserDisplayName: Brad Bell
Answers.Body: <p>I think you can only have one variable class. So the solution you posted is the only way that works.</p>
  
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2015-05-12T06:21:07.543Z
Answers.LastActivityDate: 2015-05-12T06:21:07.543Z
Answers.UserDisplayName: carlcs
Body: <p>Making a plugin.</p>
  
  <p>I can't seem to get this <code>{% set leads = craft.lead_infopack.getPacks() %}</code> to fire from within a template. </p>
  
  <p>Plugin name: lead</p>
  
  <p>Here's a look inside my variables class.</p>
  
  <p>Lead_InfopackVariable.php:</p>
  
  <pre><code>class Lead_InfopackVariable
  { 
      public function getPacks()
      {
          return craft()-&gt;lead_infopack-&gt;leads();
      }
  </code></pre>
  
  <p>The leads function calls a service that outputs all entries within my 'infopack' table.</p>
  
  <p>If I write it like this it works <code>{% set leads = craft.lead.getPacks() %}</code></p>
  
  <p>LeadVariable.php:</p>
  
  <pre><code>class LeadVariable
  { 
      public function getPacks()
      {
          return craft()-&gt;lead_infopack-&gt;leads();
      }
  }
  </code></pre>
  
Comments.ContentLicense: CC BY-SA 3.0
Comments.CreationDate: 2015-05-12T05:36:40.990Z
Comments.Text: Can you please provide some more info. What is that leads function?
Comments.UserDisplayName: carlcs
Comments.ContentLicense: CC BY-SA 3.0
Comments.CreationDate: 2015-05-12T05:51:40.037Z
Comments.Text: Sorry updated my question with more info.
Comments.UserDisplayName: R0wan
Comments.ContentLicense: CC BY-SA 3.0
Comments.CreationDate: 2015-05-12T05:59:58.293Z
Comments.Text: I could be totally wrong, but you might try `{% set leads = craft.lead.infopack.getPacks() %}`
Comments.UserDisplayName: Douglas McDonald
Comments.ContentLicense: CC BY-SA 3.0
Comments.CreationDate: 2015-05-12T06:05:00.440Z
Comments.Text: No luck - with `{% set leads = craft.lead.infopack.getPacks() %}`.
Comments.UserDisplayName: R0wan
Tags: <plugin-development>
Title: Namespace issues when calling a plugin variable
ThreadText: # Namespace issues when calling a plugin variable
  
  (Asked by: username_0 on 2015-05-12)
  
  Making a plugin.
  
  I can't seem to get this `{% set leads = craft.lead_infopack.getPacks() %}` to fire from within a template.
  
  Plugin name: lead
  
  Here's a look inside my variables class.
  
  Lead\_InfopackVariable.php:
  
  ```
  class Lead_InfopackVariable
  { 
      public function getPacks()
      {
          return craft()->lead_infopack->leads();
      }
  
  ```
  
  The leads function calls a service that outputs all entries within my 'infopack' table.
  
  If I write it like this it works `{% set leads = craft.lead.getPacks() %}`
  
  LeadVariable.php:
  
  ```
  class LeadVariable
  { 
      public function getPacks()
      {
          return craft()->lead_infopack->leads();
      }
  }
  
  ```
  
  **Tags:** plugin-development
  
  > **Comments:**
  > **username_1**: Can you please provide some more info. What is that leads function?  
  > **username_0**: Sorry updated my question with more info.  
  > **username_2**: I could be totally wrong, but you might try `{% set leads = craft.lead.infopack.getPacks() %}`  
  > **username_0**: No luck - with `{% set leads = craft.lead.infopack.getPacks() %}`.  
  
  ---
  
  ## 2 answers
  
  ### Answer by username_1 on 2015-05-12. Score: 4 | Accepted answer
  
  I think you can only have one variable class. So the solution you posted is the only way that works.
  
  
  ---
  
  ### Answer by username_3 on 2015-05-12. Score: 4
  
  [username_1](https://craftcms.stackexchange.com/a/9695/57) is correct (as usual).
  
  You can only have one variable class that maps to `craft.pluginName`, but you can have methods inside that class that map to other variable classes.
  
  
  ---
  
  