UINetwork selectedNetwork = UINetwork.getClosestNetwork(selectedNode);
if (selectedNetwork != null) {
GeneratePythonScriptAction generatePythonScriptAction = new GeneratePythonScriptAction(selectedNetwork);
generatePythonScriptAction.doAction();
} else {
throw new ActionException("No parent network to save, please select a node");
}
}