---
title: module
description: The current module.
---

The current module.

Scriptable treats each file as a module. Consider the following file.



```javascript
let circle = importModule('circle')
let r = 2
let area = circle.area(r)
log('Area of circle: ' + area)
```



The file imports the module `circle.js` which has the following contents.



```javascript
module.exports.area = (r) => {
  return Math.PI * Math.pow(r, 2)
}

module.exports.circumference = (r) => {
  return 2 * Math.PI * r
}
```



The `circle.js` module exports the functions `area` and `circumference`. You can add any function or object to the `exports` of a module to make them available when the module is imported with `importModule`.

## Properties

### exports

Exported functions and modules.

```typescript
exports: any
```

Values assigned to `exports` are returned by the global `importModule` function when the module is imported.

`exports` can be of any type but by default it is an empty object. Consider the following example which exports the `area` and `circumference` functions.



```javascript
module.exports.area = (r) => {
  return Math.PI * Math.pow(r, 2)
}

module.exports.circumference = (r) => {
  return 2 * Math.PI * r
}
```



Alternatively if you only need to export a single function or object, you can assign directly to the `exports` property as shown in the following examples.



```javascript
module.exports = (r) => {
  return 2 * Math.PI * r
}
```



`module.exports = "My string"`

### filename

Path to file containing the module.

```typescript
filename: string
```

This is the absolute path to the file containing the module.

Read-only.