Currently there isn’t a way to import from scripts or modules in scripts. There is some good discussion in this thread, with a more recent comment from @dschaefer2 explaining why this limitation exists today and what would need to change to fix it.
If you’re experimenting and learning the language I’d recommend creating a simple executable with swift package init --type executable, which gives you a small command line app to start with that should let you use modules and code spread across files more freely.