Yes, this is one of the way it worked if we want to pass the editor as a parameter. The other option was using a deferred and run the code inside the a done function from the open editor instead of a run.