Answers.Body: <blockquote>
    <p>and import that class into the Craft namespace</p>
  </blockquote>
  
  <p>Nope... it'll import that file, but will use whatever namespace the file is using (including global).</p>
  
  <p>My guess is that the <code>ChargeBee.php</code> file has a <code>ChargeBee</code> class in it that lives in the global namespace, which is why you have to reference it there.</p>
  
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2017-08-10T15:17:05.190Z
Answers.Text: Thanks for clearing that up. So there is currently no good way to bring external resources into the Craft namespace? I suppose that makes sense now that I'm thinking about it...
Answers.UserDisplayName: Paul Kirby
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2017-08-10T15:19:21.600Z
Answers.Text: And with that, what is the benefit of using `Craft::import()` over `require_once()`?
Answers.UserDisplayName: Paul Kirby
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2017-08-09T22:01:28.503Z
Answers.LastActivityDate: 2017-08-09T22:01:28.503Z
Answers.UserDisplayName: Brad Bell
Body: <p>Looking at <a href="https://craftcms.stackexchange.com/questions/11828/include-a-php-resource-within-a-plugin">this answer</a>, I suppose I am under the assumption that Craft::import() will take an alias, find the path, and import that class into the Craft namespace... which would be the benefit over simply using <code>require_once()</code>.</p>
  
  <p>Currently I import with: 
  <code>Craft::import('plugins.myplugin.resources.chargebee.lib.ChargeBee', true);</code></p>
  
  <p>Which works, however to use ChargeBee.php, I have to reference it from the global namespace. Not sure if this is the expected behaviour, but I would love to work within the Craft namespace if possible. Any help is greatly appreciated! </p>
  
Tags: <plugin-development><import>
Title: Using Craft::import() to include external resource into the Craft Namespace
ThreadText: # Using Craft::import() to include external resource into the Craft Namespace
  
  (Asked by: username_0 on 2017-08-09)
  
  Looking at [this answer](https://craftcms.stackexchange.com/questions/11828/include-a-php-resource-within-a-plugin), I suppose I am under the assumption that Craft::import() will take an alias, find the path, and import that class into the Craft namespace... which would be the benefit over simply using `require_once()`.
  
  Currently I import with:
  `Craft::import('plugins.myplugin.resources.chargebee.lib.ChargeBee', true);`
  
  Which works, however to use ChargeBee.php, I have to reference it from the global namespace. Not sure if this is the expected behaviour, but I would love to work within the Craft namespace if possible. Any help is greatly appreciated!
  
  **Tags:** plugin-development, import
  
  
  ---
  
  ## 1 answers
  
  ### Answer by username_1 on 2017-08-09. Score: 1 | Accepted answer
  
  > and import that class into the Craft namespace
  
  Nope... it'll import that file, but will use whatever namespace the file is using (including global).
  
  My guess is that the `ChargeBee.php` file has a `ChargeBee` class in it that lives in the global namespace, which is why you have to reference it there.
  
  > **Comments:**
  > **username_0**: Thanks for clearing that up. So there is currently no good way to bring external resources into the Craft namespace? I suppose that makes sense now that I'm thinking about it...  
  > **username_0**: And with that, what is the benefit of using `Craft::import()` over `require_once()`?  
  
  ---
  
  