How to generate code after importing a resource