Tuning the properties of magnetic thin films by interaction with periodic nanostructures