Setting plugin variables with a Form

I cannot get twig/md to recognise a dynamic variable.

In a plugin file, I have

class MyPlug extends Plugin 
{ protected $plugvar;
public function onPluginsInitialized() {
$this->grav['myplug'] = $this;
public function get($var) { return $this->plugvar[$var] ;}
public function set($var, $val) { $this->plugvar[$var]=$val;}
public onFormProcessed(Event $e) {
  case 'myplug':
     foreach($data as $key => $val) {
        $this->plugvar[$key] = $val; }

Then in a shortcode file

 $this->shortcode->getHandlers()->add('myplug', function(ShortcodeInterface $sc) {
  $params = $sc->getParameters();
  foreach( $params as $key => $val){
   if ($val != null ) {
      $resp = $this->grav['myplug']->get($key);
      if ($resp) return $resp;
      else return 'undefined';

In a

  name: set-operator-form
    - name: operator
      type: hidden
      content: undefined
    - type: submit
      value: "Select Operator"
    - type: reset
      value: Reset
    - myplug
    twig: true
cache_enable: false

And finally in

[myplug operator/]

The first time is served, I get an expected ‘undefined’ response in the html.

Also after clicking on the Submit button of the Form, and going to, there is no change, and I get an undefined response.

Using dump and $this->grav['debugger']->addMessage(...);
provide feedback that the operates correctly.

Somehow is not being processed again with the new dynamic information.

Is there an alternative way to get session variables? I have tried creating twig_vars, but I cannot access them across pages.

I know I am missing something, but I can’t find a clue in the documentation.

[SOLVED] The problem was eliminated by reinstalling the form plugin.