I have a command that sets a value to a key in a .sublime-settings
file and another command that retrieves the said value. Something like the following:
import sublime
import sublime_plugin
class Example1Command(sublime_plugin.TextCommand):
def run(self, edit):
settings = sublime.load_settings("name of the settings file")
settings.set("key", "value")
import sublime
import sublime_plugin
class Example2Command(sublime_plugin.TextCommand):
def run(self, edit):
settings = sublime.load_settings("name of the settings file")
print(settings.get("key"))
Assume my .sublime-settings
file is of the following structure:
{
"key": ""
}
However executing Example2Command
doesn’t print anything. What am I doing wrong ? Why is it not setting the value ?
Files for both commands & the settings file are in the same directory (which is under Packages
folder)