Answers.Body: <blockquote>
    <p>I also noticed that Contact Form Tuner seems to be loading before my plugin when testing with die statements in both plugins. Is this the reason?</p>
  </blockquote>
  
  <p>This.</p>
  
  <p>You're probably doing this from your plugin's init() function.  If you listen to the <code>EVENT_AFTER_LOAD_PLUGINS</code> event and do your logic there, it should work.</p>
  
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2019-12-14T15:36:59.757Z
Answers.Text: That worked perfectly Brad thank you.  For those in need of sample code, it's: use craft\services\Plugins; use yii\base\Event; Event::on(Plugins::class, Plugins::EVENT_AFTER_LOAD_PLUGINS, $callback);
Answers.UserDisplayName: biko
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2021-11-16T10:53:01.510Z
Answers.Text: I'm still getting `null` on `getInstance`:  ```Event::on(Plugins::class, Plugins::EVENT_AFTER_LOAD_PLUGINS, function () {
              \craft\redactor\Plugin:getInstance()->install();
          });```
Answers.UserDisplayName: Matanya
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2019-12-14T01:22:49.053Z
Answers.LastActivityDate: 2019-12-14T01:22:49.053Z
Answers.UserDisplayName: Brad Bell
Body: <p>I'm building a plugin that extends the functionality of the <a href="https://plugins.craftcms.com/contact-form-tuner" rel="nofollow noreferrer">Contact Form Tuner</a> plugin and customize the email recipients based on different scenarios.  The email addresses need to be managed in the plugin settings using forms. 
   Thus, I need to grab the settings from my plugin to be used in the Contact Form Tuner config file.</p>
  
  <p>The problem I'm having is that I can't access my plugin from the Contact Form Tuner config file.  The getInstance method returns null.  I know I have the namespace and class name right because the same statement works when running it from my plugin class.</p>
  
  <p>I also noticed that Contact Form Tuner seems to be loading before my plugin when testing with die statements in both plugins.  Is this the reason?</p>
  
  <p>Is there any way around this?</p>
  
  <p>Any help is appreciated.  Thanks!</p>
  
Tags: <plugin-development><craft3><plugin-contactform><classes>
Title: \ns\prefix\Plugin::getInstance() returns null from another plugin in Craft 3
ThreadText: # \ns\prefix\Plugin::getInstance() returns null from another plugin in Craft 3
  
  (Asked by: username_0 on 2019-12-13)
  
  I'm building a plugin that extends the functionality of the [Contact Form Tuner](https://plugins.craftcms.com/contact-form-tuner) plugin and customize the email recipients based on different scenarios. The email addresses need to be managed in the plugin settings using forms.
  Thus, I need to grab the settings from my plugin to be used in the Contact Form Tuner config file.
  
  The problem I'm having is that I can't access my plugin from the Contact Form Tuner config file. The getInstance method returns null. I know I have the namespace and class name right because the same statement works when running it from my plugin class.
  
  I also noticed that Contact Form Tuner seems to be loading before my plugin when testing with die statements in both plugins. Is this the reason?
  
  Is there any way around this?
  
  Any help is appreciated. Thanks!
  
  **Tags:** plugin-development, craft3, plugin-contactform, classes
  
  
  ---
  
  ## 1 answers
  
  ### Answer by username_1 on 2019-12-14. Score: 1 | Accepted answer
  
  > I also noticed that Contact Form Tuner seems to be loading before my plugin when testing with die statements in both plugins. Is this the reason?
  
  This.
  
  You're probably doing this from your plugin's init() function. If you listen to the `EVENT_AFTER_LOAD_PLUGINS` event and do your logic there, it should work.
  
  > **Comments:**
  > **username_0**: That worked perfectly username_1 thank you.  For those in need of sample code, it's: use craft\services\Plugins; use yii\base\Event; Event::on(Plugins::class, Plugins::EVENT_AFTER_LOAD_PLUGINS, $callback);  
  > **username_2**: I'm still getting `null` on `getInstance`:  ```Event::on(Plugins::class, Plugins::EVENT_AFTER_LOAD_PLUGINS, function () {             \craft\redactor\Plugin:getInstance()->install();         });```  
  
  ---
  
  