Given a directory path and some .m files in it, I want load these packages files mannually outside notebooks, so I created Palette using code:
CreatePalette[
Framed@Column[{(FileNameSetter[Dynamic[path], "Directory"]),
Button[
"LoadPackage", (SetOptions[Get, CharacterEncoding -> "UTF8"];
If[ Not@DirectoryQ@ToString@path,
Return@$Failed
];
Get /@ FileNames["*.m", {path}];
),
Appearance -> "Palette"]
}], WindowTitle -> "Test"];
When I want load packages, I click [Browse] to choose the directory firstly, then click [LoadPackage], but it does not work, what's the problem?

