Sublime Forum

Develop two plugin from same repo

#1

Is it possible to build two plugins from the same codebase? and the developer should be able to switch at the time of loading plugin which one to launch?

0 Likes

#2

To my knowledge there is no step at application launch that permits the user to become involved and choose to load or not load a particular plugin.

Perhaps if you explained your use case where you think that would be valuable, we might be able to find a solution that fits within the current API framework?

0 Likes

#3

Only Python files in the top level of a package are considered plugins, so you can achieve something like this by creating a folder inside of your package and putting custom code in there, and having a top level folder that does an import of symbols from one or the other of the interior files based on some criteria.

However as @Remi points out, there’s no interaction that you’re going to get when this happens; plugins just load (and only once, unless you’re actively modifying them or ignoring and un-ignoring the package they’re in).

Commands and event handlers will only work if they’re available in the symbol table of the plugin module at the time that Sublime loads it, and since most of the API of Sublime is not available until after Sublime has finished loading plugins, you’re constrained to making decisions like this based on something in a (non-settings) configuration file or based on the platform you’re currently on.

0 Likes