scheduled_tasks¶
-
Code.scheduled_tasks.run_threaded(target, daemon=None, args=(), **kwargs)[source]¶ Run a function in a thread.
Allows to run a function in a thread, which is useful for long-running tasks, and it allows the main thread to continue.
Parameters: - target : Callable
The function to run in a thread.
- daemon : Optional[bool]
Whether the thread should be a daemon thread.
- args : Iterable
The positional arguments to pass to the function.
- kwargs : Mapping[str, Any]
The keyword arguments to pass to the function.
Returns: - threading.Thread
The thread that the function is running in.
Examples
>>> run_threaded(target=Log.Info, daemon=True, args=['Hello, world!']) "Hello, world!"