Answers.Body: <p>If the method you want to access is public and in another service file, you could access it via the service layer:</p>
  
  <pre><code>craft()-&gt;theOtherPluginService-&gt;method();
  </code></pre>
  
  <p>The method you are using above, the <a href="http://php.net/manual/en/language.oop5.paamayim-nekudotayim.php" rel="nofollow">Scope Resolution Operator</a> should work fine without declaring the \Craft namespace, as the plugins should already be loaded into the Craft namespace.  It's used for accessing static and constant methods:</p>
  
  <pre><code>ClassName::method()
  </code></pre>
  
  <p>In cases where you may be loading a library that is not in the Craft namespace, the syntax you're using above would be needed, where you declare the full namespace:</p>
  
  <pre><code>\SomeOtherNameSpace\ClassName::method()
  </code></pre>
  
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2014-10-12T16:07:07.243Z
Answers.Text: Thanks for the in depth answer, Ben! I did see the way you're showing above. However, I actually think using `use \Craft\Whatever as Mything` below the namespace declaration is a working and clean way of doing it. Then you can just `Mything::method()`
Answers.UserDisplayName: Ryan
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2014-10-12T19:53:50.697Z
Answers.Text: Sounds good Ryan. I realize I was using `PluginName::method()` in my first example instead of the appropriate `ClassName::method()` (updated above). I agree that when necessary using the `use` operator below the namespace is cleaner than the full namespace in the code.
Answers.UserDisplayName: Ben Parizek
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2014-10-12T15:51:20.583Z
Answers.LastActivityDate: 2014-10-12T19:54:00.190Z
Answers.LastEditDate: 2014-10-12T19:54:00.190Z
Answers.UserDisplayName: Ben Parizek
Answers.Body: <p>I did it this way: </p>
  
  <p><code>\Craft\Shortcode::shortcode_atts()</code></p>
  
  <p>Seems directly accessing it via <strong>namespace</strong> would be correct (assuming!)</p>
  
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2014-10-12T07:18:21.967Z
Answers.LastActivityDate: 2014-10-12T07:18:21.967Z
Answers.UserDisplayName: Ryan
Body: <p>I have some functions in another plugin that I'd like to use. For example, I'm using the shortcodes plugin, and it has a function shortcode_atts that I want to use in my plugin.</p>
  
Tags: <plugin-development>
Title: Access a function in a plugin from another plugin
ThreadText: # Access a function in a plugin from another plugin
  
  (Asked by: username_0 on 2014-10-12)
  
  I have some functions in another plugin that I'd like to use. For example, I'm using the shortcodes plugin, and it has a function shortcode\_atts that I want to use in my plugin.
  
  **Tags:** plugin-development
  
  
  ---
  
  ## 2 answers
  
  ### Answer by username_1 on 2014-10-12. Score: 4
  
  If the method you want to access is public and in another service file, you could access it via the service layer:
  
  ```
  craft()->theOtherPluginService->method();
  
  ```
  
  The method you are using above, the [Scope Resolution Operator](http://php.net/manual/en/language.oop5.paamayim-nekudotayim.php) should work fine without declaring the \Craft namespace, as the plugins should already be loaded into the Craft namespace. It's used for accessing static and constant methods:
  
  ```
  ClassName::method()
  
  ```
  
  In cases where you may be loading a library that is not in the Craft namespace, the syntax you're using above would be needed, where you declare the full namespace:
  
  ```
  \SomeOtherNameSpace\ClassName::method()
  
  ```
  
  > **Comments:**
  > **username_0**: Thanks for the in depth answer, Ben! I did see the way you're showing above. However, I actually think using `use \Craft\Whatever as Mything` below the namespace declaration is a working and clean way of doing it. Then you can just `Mything::method()`  
  > **username_1**: Sounds good username_0. I realize I was using `PluginName::method()` in my first example instead of the appropriate `ClassName::method()` (updated above). I agree that when necessary using the `use` operator below the namespace is cleaner than the full namespace in the code.  
  
  ---
  
  ### Answer by username_0 on 2014-10-12. Score: 1
  
  I did it this way:
  
  `\Craft\Shortcode::shortcode_atts()`
  
  Seems directly accessing it via **namespace** would be correct (assuming!)
  
  
  ---
  
  