Hi all,
Playing with an unpacked plugin for development and reloading things “by hand”.
What is the “expected” difference between the following ?:
sublime_plugin.reload_plugin("test.main")
vs
os.utime(sys.modules['test.main'].__file__,None) # touch equivalent
It seems that when doing the touch equivalent sublime does a reload_plugin + something else …
My question could also be what is this “something else” ? (and is there an API for it ?)
Looking at randy3k/AutomaticPackageReloader
, this seems to be related to load_dummy
/ Hack to trigger automatic "reloading plugins"
thanks for your time
Regards,
toy example, main.py :
import sublime_plugin class test_command(sublime_plugin.ApplicationCommand): def __init__(self, *args, **kwargs): print("__init__ --------------->", hex(id(self.__class__))) super().__init__(*args, **kwargs) def run(self): print("run --------------->", hex(id(self.__class__))) print("module --------------->", hex(id(test_command)))
console trace :
+++ import os,sys; os.utime(sys.modules[‘test.main’].file,None)
reloading plugin test.main
module ---------------> 0x7fa68ddb1a60
__ init__ ---------------> 0x7fa68ddb1a60
+++ sublime.run_command(‘test’)
run ---------------> 0x7fa68ddb1a60
+++ import sublime_plugin; sublime_plugin.reload_plugin(‘test.main’)
reloading plugin test.main
module ---------------> 0x7fa69264b000
+++ sublime.run_command(‘test’)
run ---------------> 0x7fa68ddb1a60. <== still using old test_command