title: Call a function on created window in javaFX
body: <p>I have a window, from which I can open another one and there I'd like to call a function from the first window that affects first window itself. How can I do so?</p>
  
  <p>It doesn't work that way</p>
  
  <pre><code> FXMLLoader loader = new FXMLLoader();
              loader.setLocation(getClass().getClassLoader().getResource("view/MyWindow.fxml"));
      loader.load();
  
      MyWindowController MyWindow = loader.getController();
      MyWindow.someFunction();
  </code></pre>
  
  <p>It only works, If I call a function which affects a NEW window, like that</p>
  
  <pre><code>FXMLLoader loader = new FXMLLoader();
          loader.setLocation(getClass().getClassLoader().getResource("view/MyWindow.fxml"));
      loader.load();
  
      MyWindowController MyWindow = loader.getController();
      MyWindow.someFunction();
      Parent root;
      root = loader.getRoot();
      Stage stage = new Stage();
      stage.setTitle("View employee");
      stage.setScene(new Scene(root));
      stage.show();
      stage.setResizable(false);
  </code></pre>