> For the complete documentation index, see [llms.txt](https://nodebook.js.org/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://nodebook.js.org/python/py.md).

# PYNotebook

"PYNotebook" is used for `.py`files.

## Usage

### Setup

```javascript
const Nodebook = require('nodejs-notebook');

let main = new Nodebook.PYNotebook('main');
```

**note(code)**

Similar to `addLine()` but it does not automatically add an indent.

string `code`:\
The Python code to add.

```javascript
main.note('print("hello world"');
// Inserts this long line of code that should output "hello world"
```

**comment(comment)**

Insert a Python Comment.

string `comment`:\
The comment message to add.

```javascript
main.comment('This needs editing, Franchis!');
// Inserts '""" Look over here, Patricia! """'
```

**run()**

Attempts to run the python file.

```javascript
main.run();
// Will output if there were any errors in the console.
```

**import(module)**

Inserts `import ()` at the top with the module provided.

```javascript
main.import("json");
// Inserts "import json"
```
