This will not work, especially with states. You can create custom animations, but it still needs to be included in your "main" file.

There is a neat trick to include sub-files by id (that is, use id from "main" file in your sub-file, then include sub in main... that does not sound very clear, does it?), you can try that if you want, but I would recommend just keeping the stuff together.

Be also aware which qml file is loading the other qml file. I have encountered this problem sometimes, you find the file using Qt Creator, but when you are running the application it might be that the main.qml file is using a Component from another qml file ( that is also in another directory), and that Component is using a JS from another directory again.