# Utility

{% hint style="success" %}
*Check out this walk-through on how to import a Utility scrip.*
{% endhint %}

{% embed url="<https://files.gitbook.com/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FBLGYLEkBUnc8nVEBAuEI%2Fuploads%2FJ2aq0GbtWdb7CcRz4rdz%2FImport%20Utility%20File%20PySpark.mp4?alt=media&token=444f4733-5a54-4598-9fd2-09118d26cb78>" %}

## Importing a Utility Script <a href="#importing-a-utility-script" id="importing-a-utility-script"></a>

* Navigate to the ***Utility*** tab for a Project.
* Click the ***Add Script*** option.

<figure><img src="/files/nxXVgx4nma2sKGq5cOvc" alt=""><figcaption></figcaption></figure>

* The ***Add utility script*** page opens.
* Select the Import Utility option (This option is selected by default).
* Provide the following information:
  * Utility Name
  * Utility Description
  * Utility Script
* Click the ***Save*** option.

<figure><img src="/files/yASXsckUUtmBgRiaP1j4" alt=""><figcaption></figcaption></figure>

* A notification message appears.
* The newly created Utility Script gets added to the Utility list.

<figure><img src="/files/3XPPS5beaHg3LCKpT5Kr" alt=""><figcaption><p><em><strong>The newly created Utility script gets listed under the Utility List.</strong></em></p></figcaption></figure>

## Importing the Utility Script inside a Notebook <a href="#importing-the-utility-script-inside-a-notebook" id="importing-the-utility-script-inside-a-notebook"></a>

{% hint style="success" %}
*Check out the given video given below on how to import a utility script inside a Notebook.*
{% endhint %}

{% embed url="<https://files.gitbook.com/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FBLGYLEkBUnc8nVEBAuEI%2Fuploads%2F5P4i7OJ1POdxxAJOIACE%2FRunning%20Utility%20Script%20in%20Notebook.mp4?alt=media&token=8c2dd77c-f01d-4dc0-a4bd-996ca86e7e61>" %}
***Importing a Utility Script inside Platform***
{% endembed %}

* Copy a utility script name using the Utility list.
* Navigate to the Notebook tab.

<figure><img src="/files/txvpdY8p3MVcPlvXTdu5" alt=""><figcaption><p><em><strong>Copying the Utility script name</strong></em></p></figcaption></figure>

* Upload a Notebook or create a new Notebook and Navigate to the Notebook page.
* Add a ***Code*** ***cell***.
* Write code to import data with specific class.
* Provide the Utility script as the resource to get data.
* Specify the variables to get the class and get the data in the next code cell.
* Provide print function to see the data.
* Run all the cells.
* You can get the output below.​

<figure><img src="/files/0LqXn7vYBX6cNnIa6WeY" alt=""><figcaption><p><em><strong>Using the Utility Script inside a Notebook</strong></em></p></figcaption></figure>

## Updating the Utility Script

{% hint style="success" %}
*Check out the given walk-through on how to update a utility script.*
{% endhint %}

{% embed url="<https://files.gitbook.com/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FBLGYLEkBUnc8nVEBAuEI%2Fuploads%2FS3u5PBLQjMLn5fmqBfJ6%2FUpdating%20a%20Utility%20Script_PySpark.mp4?alt=media&token=41006ca7-345c-4130-b373-987fd607958a>" %}
***Updating Utility Script***
{% endembed %}

* Navigate to the ***Utility*** tab.
* Select an uploaded utility script from the list.
* Click the ***Edit*** icon.        &#x20;

<figure><img src="/files/ZyBafFGKN8jydIPhEZtb" alt=""><figcaption></figcaption></figure>

* The ***Update Utility Script*** page opens displaying the utility script content.
* Click the ***Validate*** option.

<figure><img src="/files/9tjiXk1JOLOb13W0pyCw" alt=""><figcaption></figcaption></figure>

* The Logs will be displayed in the Logs space.
* Click the ***Update*** option.

<figure><img src="/files/Q58Kq5CFGZEmO0OxOyTL" alt=""><figcaption></figcaption></figure>

* A success message appears.
* The selected Utility script gets updated.

<figure><img src="/files/KRwkkHhQDXabwa75PVnn" alt=""><figcaption></figcaption></figure>

{% hint style="info" %}
*<mark style="color:green;">Please Note:</mark>*&#x20;

* The name of the selected utility script cannot be changed by using the update option.
* *Refer the* [***Data Science Lab Quick Start Flow***](https://docs.bdb.ai/data-science-lab-4/data-science-lab-quick-start-flow) *page to get an overview of the **Data Science Lab** module in nutshell.*&#x20;
  {% endhint %}


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.bdb.ai/data-science-lab-4/project/tabs-for-a-data-science-lab-project/tabs-for-pyspark-environment/utility.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
