@Override
	public void run() {

		TaskMonitor interactiveTaskMonitor = plugin.getInteractiveTaskMonitor();
		JythonScript interactiveScript = plugin.getInteractiveScript();
		Program program = plugin.getCurrentProgram();
		InterpreterConsole console = plugin.getConsole();

		// Setup transaction for the execution.
		try (Transaction tx = program != null ? program.openTransaction("Jython command") : null) {
			// Setup Ghidra state to be passed into interpreter
			interactiveTaskMonitor.clearCancelled();
			interactiveScript.setSourceFile(new ResourceFile(new File("jython")));
			PluginTool tool = plugin.getTool();
			interactiveScript.set(
				new GhidraState(tool, tool.getProject(), program, plugin.getProgramLocation(),
					plugin.getProgramSelection(), plugin.getProgramHighlight()),
				new ScriptControls(console, interactiveTaskMonitor));

			// Execute the command
			moreInputWanted.set(false);
			moreInputWanted.set(plugin.getInterpreter().push(cmd, plugin.getInteractiveScript()));
		}
		catch (PyException pye) {
			String exceptionName = PyException.exceptionClassName(pye.type);
			if (exceptionName.equalsIgnoreCase("exceptions.SystemExit")) {
				plugin.reset();
			}
			else {
				console.getErrWriter()
						.println(
							"Suppressing exception: " + PyException.exceptionClassName(pye.type));
			}
		}
		catch (StackOverflowError soe) {
			console.getErrWriter().println("Stack overflow!");
		}
		finally {
			interactiveScript.end(false); // end any transactions the script may have started
		}
	}
Creates a new jython plugin execution thread that executes the given command for the given
plugin.

@param plugin The jython plugin to execute the command for.
@param cmd The jython command to execute.
@param moreInputWanted Gets set to indicate that the executed command expects more input.
Ghidra/Features/Jython/src/main/java/ghidra/jython/JythonPluginExecutionThread.java