Making two separate modules is the officially supported and recommended way to do this, particularly once you’re getting to requiring code from editor-only libraries. You can find more information on setting that up here: What is the proper method for extending the Editor Engine? - C++ - Epic Developer Community Forums
As an aside, the Classes folder is a semi-legacy thing that we don’t recommend using for new code. It exists because UHT didn’t used to parse the Public or Private folders when looking for headers, however that has long since been fixed, and these days we recommend putting all your code in either Public or Private (depending on whether it needs to be accessible from the outside). This promotes better encapsulation of your module, and also avoids potentially large rebuilds, as the headers in the Classes folder get lumped into a single massive include file which can cause all of your code to rebuild when changing a header - the other folders don’t have this issue as they allow you to go with an “include what you use” strategy instead.