<!-- mobian-agent-page publisher="dailydev" canonical="https://daily.dev/posts/how-to-pass-arguments-to-qrunnable-worker-threads-in-pyqt6-3teggi4li" -->

---
title: How to Pass Arguments to QRunnable Worker Threads in PyQt6
description: Writing 'self.model.do_this("message")' when creating a QRunnable Worker calls the function immediately on the main thread, freezing the GUI until it finishes....
canonical: https://daily.dev/posts/how-to-pass-arguments-to-qrunnable-worker-threads-in-pyqt6-3teggi4li
twitter:card: summary_large_image
twitter:site: @dailydotdev
og:type: website
og:site_name: daily.dev
og:title: How to Pass Arguments to QRunnable Worker Threads in PyQt6 | daily.dev
og:description: Writing 'self.model.do_this("message")' when creating a QRunnable Worker calls the function immediately on the main thread, freezing the GUI until it finishes....
og:url: https://daily.dev/posts/how-to-pass-arguments-to-qrunnable-worker-threads-in-pyqt6-3teggi4li
og:image: https://api.daily.dev/og/posts/3tEgGi4lI.png
og:image:alt: How to Pass Arguments to QRunnable Worker Threads in PyQt6
og:image:width: 1200
og:image:height: 630
og:locale: en
---

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

# How to Pass Arguments to QRunnable Worker Threads in PyQt6

**[Planet Python](https://daily.dev/sources/planetpython)** · 6 min read · 0 upvotes · 0 comments

## Summary

Writing 'self.model.do_this("message")' when creating a QRunnable Worker calls the function immediately on the main thread, freezing the GUI until it finishes. The fix is to pass the function reference and its arguments separately, like 'Worker(self.model.do_this, "message")'. The Worker's __init__ stores fn, args and kwargs, then calls 'self.fn(*self.args, **self.kwargs)' inside run(), which executes on the background thread. This keeps the GUI responsive while the task runs.

## Full article

daily.dev links to this article rather than hosting it. Read it at the original source: <https://www.pythonguis.com/faq/delay-in-signal-from-thread>

## Questions this post answers

### Why does my PyQt6 GUI freeze even though I'm using QThreadPool and QRunnable?

The GUI freezes when you call the worker function with parentheses, like Worker(self.model.do_this("msg")), because Python executes it immediately on the main thread before Worker ever runs. The function completes fully, including any long-running work, and only its return value (often None) gets passed to Worker. Pass the function reference without parentheses instead.

_Developers debugging PyQt6 thread freezes track fixes like this on daily.dev._

### How do I pass arguments to a function running in a QRunnable worker thread in PyQt6?

Pass the function and its arguments as separate items to the Worker constructor: Worker(self.model.do_this, "This is a message"). The Worker's __init__ accepts fn, *args, and **kwargs, storing them, then its run() method calls self.fn(*self.args, **self.kwargs) on the background thread so the GUI stays responsive.

_daily.dev helps developers building PyQt6 apps find patterns like this QRunnable fix._

### What is the difference between Worker(self.model.do_this) and Worker(self.model.do_this("hello")) in PyQt6?

Worker(self.model.do_this) passes the function itself, which then runs on the worker thread when run() is called. Worker(self.model.do_this("hello")) calls the function immediately on the main thread and passes its None return value to Worker instead, blocking the GUI for the task's full duration.

_Anyone wiring up QThreadPool workers can bookmark distinctions like this on daily.dev._

## Similar posts on daily.dev

- [Fix QImage NumPy Crash in PyQt6 PySide6 Multithreaded Applications](https://daily.dev/posts/fix-qimage-numpy-crash-in-pyqt6-pyside6-multithreaded-applications-w2seqhocw) · Planet Python · 0 upvotes · 0 comments
- [How to stop background threads on exit in PyQt6 — closeEvent cleanup](https://daily.dev/posts/how-to-stop-background-threads-on-exit-in-pyqt6-closeevent-cleanup-d72mh5tpc) · Planet Python · 0 upvotes · 0 comments
- [What does @pyqtSlot\(\) do?](https://daily.dev/posts/what-does-pyqtslot-do--gcifm7n0r) · Planet Python · 1 upvotes · 0 comments
- [Wayland Wars, a Custom File Picker, and Non-Blocking Threads: Building a Responsive Qt App](https://daily.dev/posts/wayland-wars-a-custom-file-picker-and-non-blocking-threads-building-a-responsive-qt-app-pcji3yhzg) · Medium · 0 upvotes · 0 comments
- [Qt Designer and Python: Build Your GUI Applications Faster Quiz – Real Python](https://daily.dev/posts/qt-designer-and-python-build-your-gui-applications-faster-quiz-real-python-cxq2kgbpx) · Real Python · 1 upvotes · 0 comments

---

Tags: [#python](https://daily.dev/tags/python), [#qt](https://daily.dev/tags/qt)

[View this post on daily.dev](https://daily.dev/posts/how-to-pass-arguments-to-qrunnable-worker-threads-in-pyqt6-3teggi4li)

```json
{"@context":"https://schema.org","@graph":[{"@type":"Organization","@id":"https://daily.dev/#organization","name":"daily.dev","url":"https://daily.dev","logo":{"@type":"ImageObject","url":"https://daily.dev/apple-touch-icon.png","width":180,"height":180},"sameAs":["https://twitter.com/dailydotdev","https://github.com/dailydotdev","https://www.linkedin.com/company/daily-dev-ltd"]},{"@type":"WebSite","@id":"https://daily.dev/#website","url":"https://daily.dev","name":"daily.dev","publisher":{"@id":"https://daily.dev/#organization"},"potentialAction":{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https://daily.dev/search?q={search_term_string}"},"query-input":"required name=search_term_string"}}]}
{"@context":"https://schema.org","@type":"TechArticle","headline":"How to Pass Arguments to QRunnable Worker Threads in PyQt6","url":"https://daily.dev/posts/how-to-pass-arguments-to-qrunnable-worker-threads-in-pyqt6-3teggi4li","mainEntityOfPage":{"@type":"WebPage","@id":"https://daily.dev/posts/how-to-pass-arguments-to-qrunnable-worker-threads-in-pyqt6-3teggi4li"},"datePublished":"2026-10-28T07:52:25.021Z","dateModified":"2026-10-28T08:00:37.458Z","description":"Writing 'self.model.do_this(\"message\")' when creating a QRunnable Worker calls the function immediately on the main thread, freezing the GUI until it finishes....","image":"https://media.daily.dev/image/upload/f_auto,q_auto/v1/posts/14bb6cf5f2ed4e1f76ac03317753bcd5?_a=AQAEuop","thumbnailUrl":"https://media.daily.dev/image/upload/f_auto,q_auto/v1/posts/14bb6cf5f2ed4e1f76ac03317753bcd5?_a=AQAEuop","isAccessibleForFree":true,"articleSection":"Planet Python","inLanguage":"en","publisher":{"@type":"Organization","name":"daily.dev","url":"https://daily.dev","logo":{"@type":"ImageObject","url":"https://daily.dev/apple-touch-icon.png","width":180,"height":180}},"author":{"@type":"Organization","name":"Planet Python","logo":"https://media.daily.dev/image/upload/t_logo,f_auto/v1/logos/eac3cc584cb043b5a242d13752bd3d0c","url":"https://daily.dev/sources/planetpython"},"commentCount":0,"discussionUrl":"https://daily.dev/posts/how-to-pass-arguments-to-qrunnable-worker-threads-in-pyqt6-3teggi4li","interactionStatistic":[{"@type":"InteractionCounter","interactionType":{"@type":"LikeAction"},"userInteractionCount":0},{"@type":"InteractionCounter","interactionType":{"@type":"CommentAction"},"userInteractionCount":0}],"keywords":"python,qt","timeRequired":"PT6M"}
{"@context":"https://schema.org","@type":"BreadcrumbList","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https://daily.dev"},{"@type":"ListItem","position":2,"name":"Planet Python","item":"https://daily.dev/sources/planetpython"},{"@type":"ListItem","position":3,"name":"How to Pass Arguments to QRunnable Worker Threads in PyQt6"}]}
{"@context":"https://schema.org","@type":"FAQPage","@id":"https://daily.dev/posts/how-to-pass-arguments-to-qrunnable-worker-threads-in-pyqt6-3teggi4li#faq","mainEntity":[{"@type":"Question","name":"Why does my PyQt6 GUI freeze even though I'm using QThreadPool and QRunnable?","acceptedAnswer":{"@type":"Answer","text":"The GUI freezes when you call the worker function with parentheses, like Worker(self.model.do_this(\"msg\")), because Python executes it immediately on the main thread before Worker ever runs. The function completes fully, including any long-running work, and only its return value (often None) gets passed to Worker. Pass the function reference without parentheses instead. Developers debugging PyQt6 thread freezes track fixes like this on daily.dev."}},{"@type":"Question","name":"How do I pass arguments to a function running in a QRunnable worker thread in PyQt6?","acceptedAnswer":{"@type":"Answer","text":"Pass the function and its arguments as separate items to the Worker constructor: Worker(self.model.do_this, \"This is a message\"). The Worker's __init__ accepts fn, *args, and **kwargs, storing them, then its run() method calls self.fn(*self.args, **self.kwargs) on the background thread so the GUI stays responsive. daily.dev helps developers building PyQt6 apps find patterns like this QRunnable fix."}},{"@type":"Question","name":"What is the difference between Worker(self.model.do_this) and Worker(self.model.do_this(\"hello\")) in PyQt6?","acceptedAnswer":{"@type":"Answer","text":"Worker(self.model.do_this) passes the function itself, which then runs on the worker thread when run() is called. Worker(self.model.do_this(\"hello\")) calls the function immediately on the main thread and passes its None return value to Worker instead, blocking the GUI for the task's full duration. Anyone wiring up QThreadPool workers can bookmark distinctions like this on daily.dev."}}]}
```

