> For the complete documentation index, see [llms.txt](https://docs.bdb.ai/data-science-lab-4/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.bdb.ai/data-science-lab-4/project/tabs-for-a-data-science-lab-project/tabs-for-pyspark-environment/utility.md).

# Utility

This tab allows to create and list the python scripts (.py files) that can be imported to your notebook.

{% 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="https://content.gitbook.com/content/1QeOywZjV1cHo55cMW8u/blobs/2DmGgw35t5eL6FQIFF2N/image.png" 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="https://content.gitbook.com/content/1QeOywZjV1cHo55cMW8u/blobs/ZFaLuynWSidDEMyil26C/image.png" alt=""><figcaption></figcaption></figure>

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

<figure><img src="https://content.gitbook.com/content/1QeOywZjV1cHo55cMW8u/blobs/AXB2iV4Yl1tBxsTxZ6OT/image.png" 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="https://content.gitbook.com/content/1QeOywZjV1cHo55cMW8u/blobs/sRV01ZPCNfhjXCAk1Wcs/image.png" 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="https://content.gitbook.com/content/1QeOywZjV1cHo55cMW8u/blobs/vTCuj0tnVGFW8fSyYlYL/image.png" 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="https://content.gitbook.com/content/1QeOywZjV1cHo55cMW8u/blobs/q4Uydy69qZRHS2PTYTmi/image.png" alt=""><figcaption></figcaption></figure>

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

<figure><img src="https://content.gitbook.com/content/1QeOywZjV1cHo55cMW8u/blobs/FEM7pSd6LJ5DhoG6829Y/image.png" alt=""><figcaption></figcaption></figure>

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

<figure><img src="https://content.gitbook.com/content/1QeOywZjV1cHo55cMW8u/blobs/3zpfC8Tg5t2k1P73PkaM/image.png" alt=""><figcaption></figcaption></figure>

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

<figure><img src="https://content.gitbook.com/content/1QeOywZjV1cHo55cMW8u/blobs/RRGZSJL85z9LS6niGHys/image.png" 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 %}
