Closed jcberquist closed 8 years ago
why not trying yourself? (and the answer is yes).
Sorry if I wasn't clear. It seems to me that if a .py
file containing a plugin_loaded()
function is in a package subfolder, and is reloaded by this plugin, plugin_loaded()
isn't called on the reload. (And it is called by ST on initial package load.)
I asked the way I did because I don't understand what you are doing well enough to know for sure what is and isn't happening :)
I don't think plugin_loaded()
in .py
file inside a subfolder will be ever loaded in the first place.
The .py
file should be at the top level.
Consider this
(rmbpro)-Packages$ tree Test
Test
└── bar
└── __init__.py
1 directory, 1 file
(rmbpro)-Packages$ cat Test/bar/__init__.py
def plugin_loaded():
print("foo")
Thanks for looking at this. If you have a top level file that imports bar, so:
Test
└── bar
└── __init__.py
└── testme.py
testme.py
:
from . import bar
plugin_loaded()
in bar/__init__.py
will be called when ST first loads.
Maybe that's a crazy structure? :smile: But at any rate, that is what I was hoping could happen on reload.
Oh, I think it is an issue of Sublime Text itself.
Check the difference between reload_plugin
and on_api_ready
.
on_api_ready
is launched at startup and finds all plugin_loaded
.
reload_plugin
is used to reload top level plugins, e.g., reload_plugin("Test.testme")
and only reload plugin_loaded
in testme.py
.
My suggestion is to rename all plugin_loaded
in subdir to something and export the calls to top level to execute them
from .bar import call1
from .foo import call2
def plugin_loaded():
call1()
call2()
Makes sense, and thanks for explaining it to me!
When reloading submodules does/can this call
plugin_loaded()
if it is present?