// Module path $module_handler = \Drupal::service('module_handler'); $module_path = $module_handler->getModule('my_module')->getPath();