@wbond
That code is kind of over my head .
It seems like it’s maybe more complex than what I need to implement.
Pretty much, the only scenario I’ll be working with is a single dependency @ Packages/_UTILS
The entire contents of the _UTILS
directory is:
[ Comments.py, Edit.py, Indentation.py, Region.py, Sort.py, Verify.py, Variables.py ]
( Discarding the __ALL_UTILS__
module I mentioned before. I don’t think I would need it anymore using your method? )
I tried going back to the first method I attempted, like in your SFTP plugin.
Here is what I have:
from imp import reload
from sys import modules
reload_mods = []
for mod in modules:
if mod[0:6] == "_UTILS" \
and modules[mod] != None:
print ( mod )
reload_mods.append(mod)
mods_load_order = [
"_UTILS",
"_UTILS.Comments",
"_UTILS.Edit",
"_UTILS.Indentation",
"_UTILS.Region",
"_UTILS.Sort",
"_UTILS.Verify",
"_UTILS.Variables",
]
for mod in mods_load_order:
if mod in reload_mods:
print ( mod )
reload(modules[mod])
Comments.test()
When I save, the print ( mod )
@ both for mod in modules
& for mod in mods_load_order
is returning:
_UTILS
_UTILS.Comments
_UTILS.Edit
_UTILS.Indentation
_UTILS.Region
_UTILS.Sort
_UTILS.Verify
So I’m guessing the values are valid as far as modules
is concerned.
( although _UTILS.Variables
isn’t being picked up for some reason… )
This is the traceback I’m getting @ Comments.test()
( I also tried _UTILS.Comments.test()
)
Traceback (most recent call last):
File "C:\Program Files\Sublime Text 3\sublime_plugin.py", line 76, in reload_plugin
m = imp.reload(m)
File "./imp.py", line 276, in reload
File "<frozen importlib._bootstrap>", line 584, in _check_name_wrapper
File "<frozen importlib._bootstrap>", line 1022, in load_module
File "<frozen importlib._bootstrap>", line 1003, in load_module
File "<frozen importlib._bootstrap>", line 560, in module_for_loader_wrapper
File "<frozen importlib._bootstrap>", line 868, in _load_module
File "<frozen importlib._bootstrap>", line 313, in _call_with_frames_removed
File "C:\Users\Fico\AppData\Roaming\Sublime Text 3\Packages\Parkour_v1\Parkour_v1.py", line 48, in <module>
Comments.test()
NameError: name 'Comments' is not defined