I don’t really have an understanding of what kind of data you are sharing and for what purpose. I’m just throwing things out.
Ideally you could avoid importing the other plugin and just create a sublime command that the other plugin calls. On receiving the call, it could save away the data in global variable or something like that.
I personally like the settings method as you could technically obtain return info as well by having the receiver write return data to the settings on completion. Sublime commands don’t really offer a return, but you could write return data in the settings file. Its kind of like using a named pipe to send data. The data essentially gets serialized to a buffer that is sharable. You can even add a callback for on_change events when settings change.
In the ColorHelper plugin, I do this to retrieve the color from the ColorPicker plugin:
s = sublime.load_settings('color_helper_share.sublime-settings')
s.set('color_pick_return', None)
self.view.window().run_command(
'color_pick_api_get_color',
{'settings': 'color_helper_share.sublime-settings', "default_color": color[1:]}
)
new_color = s.get('color_pick_return', None)
Its possible you could pull off the same thing by sending a dictionary as a variable to the other plugin’s command as the variable is mutable reference. I’ve never tried it that way, but it might work.
How can I define another plugin as a dependency.
Will PackageControl installe those dependend plugins automatically?
You can only add modules as dependencies, not Sublime plugins. Usually I just add a note in the plugin that mentions prerequisites. In that sense I feel it is no different that plugins that require external binaries, like plugins that call node.js, send files to external programs. The user has a little setup, but then they are good to go.