Hi all,
I am developing a plugin (foobar.py) that I would like to separate into two different plugins.
In foo.py:
class FooCommand(sublime_plugin.WindowCommand):
def run(self, foo_arg):
pass
def input(self, args):
return FooArgInputHandler()
FooArgInputHandler()
would also be implemented in foo.py.
In bar.py, I would like to implement something like this:
class BarCommand(sublime_plugin.WindowCommand):
def run(self, bar_arg):
# does something with bar_arg
self.window.run_command('foo')
def input(self, args):
return BarArgInputHandler()
because no args are provided when calling run_command
, then I would expect Sublime to instantiate and display FooArgInputHandler. Instead, I get an error:
run() missing 1 required positional argument: 'foo_arg'
My workaround is that BarArgInputHandler() has a next_input()
to return FooArgInputHandler()
, then BarCommand.run
takes two arguments (bar_arg, foo_arg)
and I can run foo command with foo_arg
.
But then I cannot separate foobar.py
into two different plugins, because I don’t know how to import FooArgInputHandler()
from bar.py
.
I think that this use case should be very common, and most probably I am doing something obviously wrong. Can you help me?
Many thanks!