Sublime Forum

ViewEventListener __init__ API safe?

#1

The API docs say:

At importing time, plugins may not call any API functions, with the exception of sublime.version(), sublime.platform(), sublime.architecture() and sublime.channel().

It’s not clear to me if a ViewEventListener is initialized before or after “importing time”. I’m in a situation where I need to call sublime.load_resource in an __init__ of a ViewEventListener. So, safe to do it in __init__ or do I need to write more logic to “wait” for importing time to be over?

0 Likes

#2

ViewEventListeners are initialized when their is_applicable classmethod (I can never remember that name) returns true. As far as I can tell, this will always be called after the api has been initialized.

2 Likes