Home Explore Blog CI



nushell

commands/docs/export_module.md
65c228926dddbc79fa84628817607b180f7b4a27d9cd41d0000000030000042a
---
title: export module
categories: |
  core
version: 0.104.0
core: |
  Export a custom module from a module.
usage: |
  Export a custom module from a module.
editLink: false
contributors: false
---
<!-- This file is automatically generated. Please edit the command in https://github.com/nushell/nushell instead. -->

# `export module` for [core](/commands/categories/core.md)

<div class='command-title'>Export a custom module from a module.</div>

## Signature

```> export module {flags} (module) (block)```

## Parameters

 -  `module`: Module name or module path.
 -  `block`: Body of the module if 'module' parameter is not a path.


## Input/output types:

| input   | output  |
| ------- | ------- |
| nothing | nothing |
## Examples

Define a custom command in a submodule of a module and call it
```nu
> module spam {
        export module eggs {
            export def foo [] { "foo" }
        }
    }
    use spam eggs
    eggs foo
foo
```

## Notes
This command is a parser keyword. For details, check:
  https://www.nushell.sh/book/thinking_in_nu.html

Chunks
a76955a4 (1st chunk of `commands/docs/export_module.md`)
Title: export module
Summary
This document describes the `export module` command in Nushell, which allows exporting a custom module from within another module. It details the command's signature, parameters (module name/path and block), input/output types, and provides an example of defining and calling a custom command within a submodule.