Skip to content

Running a task from inside a Python script #112

Description

@brspurri

Hi there,

I am new to invoke so please forgive my inexperience.
I am trying to set up several @tasks but I would like to be able to execute them from within a Python script.

There is plenty of excllent documentation on how to execute a task from the command line, but is this possible from within a script?

I can certainly execute a system command using invoke.runner.run('ls -la'), but if I had the task

@task
def mytask():
    run("ls -la")

how could I use invoke to call mytask from inside a script?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions