# Issues when using system.util.invokeAsynchronous() I get a 'NoneType' object is not callable error

**URL:** <https://forum.inductiveautomation.com/t/issues-when-using-system-util-invokeasynchronous-i-get-a-nonetype-object-is-not-callable-error/97022>\
**Category:** Ignition\
**Tags:** perspective, scripting\
**Created:** [October 9, 2024, 2:06pm UTC](https://forum.inductiveautomation.com/t/issues-when-using-system-util-invokeasynchronous-i-get-a-nonetype-object-is-not-callable-error/97022 "2024-10-09T14:06:44Z")\
**Posts on this page:** 1\
**Showing post:** 12

<div class="post-metadata">

**Author:** ![francisco.salinas](https://avatars.discourse-cdn.com/v4/letter/f/ce73a5/32.png) [@francisco.salinas](https://forum.inductiveautomation.com/u/francisco.salinas)\
**Post date:** [December 9, 2025, 3:58pm UTC](https://forum.inductiveautomation.com/t/issues-when-using-system-util-invokeasynchronous-i-get-a-nonetype-object-is-not-callable-error/97022/12 "2025-12-09T15:58:41Z")

</div>

The following is @paul-griffith's answer without a callback so `futures` can be accessed on the main thread and allow for simpler error handling:

```python
from java.util.concurrent import CompletableFuture
from java.util.function import Consumer, Supplier
from functools import partial
from time import sleep

# Adapts a Python function to act as a Java "Consumer" functional interface
# Works when called directly or as a decorator with @ syntax
def java_consumer(func):
	class PythonConsumer(Consumer):
		def accept(self, t):
			func(t)
	return PythonConsumer()

# Adapts a Python function to act as a Java "Supplier" functional interface
def java_supplier(func):
	class PythonSupplier(Supplier):
		def get(self):
			return func()
	return PythonSupplier()

# Mock update function that just blocks for a fixed delay
def updateSize(row):
	sleep(2)
	return {"SIZE": row}
	

def runUpdates():
	# Just some mock data to stick to the general structure of the existing code
	tagData = system.dataset.toDataSet(["a", "b"], [[1, 2], [2, 3], [3, 4]])
	pyTagData = system.dataset.toPyDataSet(tagData)
	
	futures = []
	for row in pyTagData:
		# Some antics here to adapt types and wrap up default arguments
		supplier = java_supplier(partial(updateSize, row))
		# supplyAsync is a static method that will use Java's built in ForkJoinPool thread pool
		futures.append(CompletableFuture.supplyAsync(supplier))

	# the callback is no longer needed with the use of .get()
	CompletableFuture.allOf(futures).get()

	for i, future in enumerate(futures):
		print i, future.get()

runUpdates()

```

---

_[View the full topic](https://forum.inductiveautomation.com/t/issues-when-using-system-util-invokeasynchronous-i-get-a-nonetype-object-is-not-callable-error/97022)._
