TaskWeaver
TaskWeaver copied to clipboard
Set session variables inside a plugin
trafficstars
I would like to set session variables inside plugin so i can use those variables inside other plugin. Is there a way to do it?
I haven't tried this, but I think it is doable as all the executions in the same session share the same context. But I think you need to modify the code in context.py. You can find the following code there
def get_session_var(
self,
variable_name: str,
default: Optional[str] = None,
) -> Optional[str]:
if variable_name in self.executor.session_var:
return self.executor.session_var[variable_name]
return default
What you need is to implement another function set_session_var accordingly.
Okay thank you. I’ll try to implement this