---
title: "Python 3.9.4"
slug: "python-394"
updated: 2024-09-10T21:48:12Z
published: 2024-09-10T21:48:12Z
canonical: "docs.skillable.com/python-394"
---

> ## Documentation Index
> Fetch the complete documentation index at: https://docs.skillable.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Python 3.9.4

Skillable Studio allows execution of scripts against a cloud subscription, as well as executing scripts that do not have a target. Scripts are used in Automated Activities and Life Cycle Actions.

## Using Python Import Keyword

The `import` keyword is used to import modules.

```Python
#Import the datetime module and display the current date and time
import datetime

x = datetime.datetime.now()
print(x)
```

## Interacting with Skillable Studio

Your scripts can communicate success or failure to Skillable Studio in one of two ways.

### Return a Boolean value

```Python
//do stuff... all good
return True;
```

```Python
//do stuff... uh oh
return False;
```

### Use setActivityResult

```Python
//do stuff... all good
setActivityResult(True);
```

```Python
//do stuff... uh oh
setActivityResult(False);
```

You can also report the result as a score %...

```Python
//do stuff... we want to report success and set the score value as 50%
setActivityResult(0.5);
```

### Send a Notification to the User

Notifications appear as real-time toast notification in the lab client.

```Python
sendLabNotification("A notification from Python!");
```

### Lab Variables

Lab variables are always string name/value pairs. Variable values are scoped to the lab instances and become available within the lab instructions as well as subsequent script executions.

```Python
setLabVariable("myVariable1", "This was set by Python in the cloud!");
```

You can "receive" a variable in your script...

```Python
#a variable set elsewhere in the lab, but we can use it in our script
const myVariable1 = "@lab.Variable(myVariable1)";
```

### Use setActivityResult

If you choose to use setActivityResult, the last time it is called within your script will determine the outcome.

```Python
setTimeout(function() {
    console.log("This message was left inside the async code.");
    setActivityResult(True);
}, 1000);
return False; //<- this will have no effect, as it will be evaluated before the async code is run.
```
