Trouble calling service methods from primary module class I created a module for Craft 3 using pluginfactory.io, and am unable to call services from the primary module class using $this-&gt;orders-&gt;method() as shown in the documentation.

The services appear to be registered correctly, as I'm able to call the service methods elsewhere in the module using the SiteModule::$instance-&gt;orders-&gt;method() format.

The line use modules\sitemodule\services\Orders as OrdersService is at the top of the module class, but removing makes no difference in being able to call those service methods from the primary module class.

What is the correct way to call service methods from a primary module class?
Where do you instantiate your orders component?

As long as you're calling the setComponents early in your init method as follow, you should be able to access it anywhere in your plugin class:

...
parent::init();
self::$plugin = $this;
$this-&gt;setComponents([
        'orders' =&gt; OrdersService::class,
]);
...