The code in your initial post appears to be correct. Maybe you didn't set the right script purpose properties. The easiest way to get help is to share a project file, so others can see exactly what you've done - otherwise all we can do is guess.
Basically the code above is all i did to test the import/export. I solved it as the problem was on my end, i forgot to export the class properly. Thanks for your reply