Modules aren't loaded from a code reference — they must be part of the project. This error has the following cause and solution:
MyModule.SomeVar = 5 generates this error when MyModule isn't visible in the project MyProject.
See your host application documentation for information on including the module in the project.