Scope of Class in a Module

Using Xojo 2021r2.1, I have a Public class MyThing declared inside ModuleA. In another module, I create an instance of that class and assign it to a Global property Thing of Module A:

TheThing = new.MyThing

it compiles and runs.

I then dragged Module A to a different Xojo project. When I try to compile this project, I get the error:

Can't find a type with this name. Did you mean class ModuleA.MyThing?

Why did the class’s scope seemingly change on dragging the module to a new project? It shows as Public in the IDE in both projects.

I’m not sure why the scope would have changed that could be an IDE bug. To skip using the namespace set the scope to “Global”.

Documentation on Scope

Personally though, I recommend scoping everything as tightly as you can. This makes it so the compiler can help you find unintentional errors before they reach runtime.

Yep, that eliminates the error.