To this to work you'd need to add this to the code stage or a global code part of the object also make sure the code stage is running constantly. I don't think it is a good practice because it is constantly consuming your license
If you would like to start a BP process based on a file trigger without consuming a license you would need to write your own program/script that would run side by side next to Blue Prism.