How I can update variable globvar
from 0
to 1
?
import sublime_plugin
class TestMe(sublime_plugin.EventListener):
def on_activated(self, view):
globvar = 0 # The goal is to update this var from 0 to 1
def updateme():
global globvar
globvar = 1
def printme():
print(globvar)
updateme()
printme() # It *should* print 1
This code snippet (all credits to Paul Stephenson) should print 1
. And actually it works when I test it in online Python playgrounds, for example here.
But for some reason, in Sublime (ST3 build 3126) it prints 0
. Very strange. How it could be fixed?