Page 1 of 1

[SOLVED] Add a delay before executing the next command

Published: July 15, 2019 - 4:18 PM
by Patrice_minagri
Hello,

I'm running several commands within a packet, but I'd like a two-second delay between each one.

I tried the `time.sleep(2)` , but when I run the code (via PyScripter), I get an error message:
`NameError: global name 'time' is not defined`

. How can I add a delay differently?

Thank you.

WAPT version used: 1.4.3.2

Re: Adding a delay before executing the next command

Published: July 17, 2019 - 08:52
by Mathieu
Hi,

You need to import the `time` function at the beginning of your script

Code: Select all

# -*- coding: utf-8 -*-
from setuphelpers import *
import time