How to access a parent paragraph twig file from a child node twig file? In my bootstrap theme, I am trying to make the id of the paragraph the same as an attribute for each of the child nodes, so an accordion will work properly. I have tried looking at doing it through hooks, but I can't seem to access the paragraph data from my node hook.
You can use hook_preprocess_paragraph hook to set the same id to all child nodes, in the below code snippet example all child nodes will have paragraph-PARAGRAPH-ID as id.

use Drupal\Component\Utility\Html;
/**
 * Implements hook_preprocess_HOOK().
 */
function myModule_preprocess_paragraph(&amp;$variables) {
  $paragraph = $variables['paragraph'];
  $identifier = Html::cleanCssIdentifier('paragraph-' . $paragraph-&gt;id());
  $variables['attributes']['id'] = $identifier;
}