Good time of day everyone.I want to create plugin for ST3. But I am not familar with Python3. I decided to write it in other script language. So, I need code snippet to run my script (external program) in backround mode and to do something when script is finished.

You don't really show enough code to see what is wrong. Also, you are not supposed to retain or pass the "edit" object between threads. Instead, call view.run_command of a second TextCommand that will apply the appropriate changes.

As an aside, using the sublime.set_timeout_async function might be simpler than manually creating a thread.

I think you may have misunderstood when I said it needs to run a second TextCommand. You need to call set_timeout_async on your own function that will do the long computation, and then call the TextCommand. It would look something roughly like this:

I didn't test this, so there may be typos, but it's the general idea. Also, you may have problems if there are multiple cursors (the positions may shift, so you may want to iterate over the Selection in reverse).