title: codeigniter 4 set session variable $session = \Config\Services::session(); globally
body: <p>in codeigniter 4 as per the <a href="https://codeigniter4.github.io/userguide/libraries/sessions.html" rel="noreferrer">documentation</a> we have to load library as </p>
  
  <p>$session = \Config\Services::session();</p>
  
  <p>if i write it on above of controller name </p>
  
  <pre><code>&lt;?php
  namespace App\Controllers;
  
      $session = \Config\Services::session();
  
      class Home extends BaseController
      {
  
      }
  </code></pre>
  
  <p>i cant access $session variable in any function, even if i wrote it in __construct it is not accessible in any function if i write it any function then only it is working, but i wants to set it globally.</p>