You can reference the build.zig files of your dependency using this method, so it is commenly used for things like Mach apps where they provide methods for setting up your application how that framework expects you to use it.
In order to @import("non_std_module") in your build.zig that module will need to be in your build.zig.zon. When you import it, it will contail whatever is pub in the dependencies build.zig file.
If you want to include your own files, then you will need to import the file with the .zig suffix.
When you import a dependency in your build.zig you are importing what was publicly declared in the build.zig of the corresponding dependency.
My go to project to look at, for these sort of things is
it uses a lot of the more advanced possibilities of the build system.
Here is an example of how it is used:
And here is the definition of the website function within Zine’s build.zig:
Note that this means that you only can import and use projects this way that have specifically defined pub declarations in their build.zig.
As far as I can tell/remember this was specifically done so that building a project could be done with less/more-specific dependencies/code.