How can my script be sure that some other script used gets loaded.
For now, I'm using addon_utils.enable("some_needed_addon") inside the register() function of init.py of my script
and addon_utils.disable("some_needed_addon") in the unregister()
and at the biginning or this init.py I have
if "bpy" in locals(): import importlib importlib.reload(my_first_py_file) importlib.reload(my_second_py_file) else: import bpy import addon_utils # To use some other addons
With all that, when you call the new file command, the other script is no longer activated so it is not callable, because I didn't save it in user preferences and don't want to because I'm not sure user will want that.