0

I am trying to set a Javascript local variable within a PyScript script (directly in Python):

from js import sessionStorage
from js import window
from js import alert
from pyodide import create_proxy, to_js

word2 = "hello"
word3 = "goodbye"

sessionStorage.setItem("word2", word2);
sessionStorage.setItem("word3", word3);

The equivalent that I am trying to achieve in Javascript would be:

var word2 = "hello"
var word3 = "goodbye"

sessionStorage.setItem("word2", word2);
sessionStorage.setItem("word3", word3);

How could I do this directly in Python PyScript?

user3535901
  • 3,518
  • 2
  • 13
  • 10

0 Answers0