How can i set a function into session

Hi everybody;

I’m trying to set a session with a function for reactivity; as u can see it’s already defined in rules but functions are not in the session. Is there a way for it. Thanks.

    if (!_.isUndefined(window[collection].autoCms)) {
      rules = window[collection].autoCms;
    } else {
      rules = window[collection].autoOne;
    }
    Session.set('autocms-rules', rules);
    
    console.log(rules);
    console.log(Session.get('autocms-rules'));

In console;

You can only store EJSON supported types in the Session; functions are excluded.

I got it thanks hwillson