'How to create a JavaFX project within another project and open it in IntelliJ

I wanna add JavaFX to an existing project in IntelliJ and followed this documentation.

I created a folder structure with an folder with an JavaFX project in it. If I open only this folder who contains JavaFX within IntelliJ everything gets imported correctly and the sample main is running. If I open the whole project where the folder with JavaFX is an subfolder only I get a lot of red and running the main results in many errors. How can I open a JavaFX project within another project in IntelliJ?

IntelliJ Project structure if it does work

GUI
+-- JavaFXRelatedFiles

IntelliJ Project structure if it does not work

+-- src
|   +-- GUI
|   +-- OtherFolder


Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source