# Problems using python with Editor in UE4

**URL:** <https://forums.unrealengine.com/t/problems-using-python-with-editor-in-ue4/244763>\
**Category:** Editor Scripting\
**Tags:** unreal-engine, UE4-26\
**Created:** [August 10, 2021, 7:07am UTC](https://forums.unrealengine.com/t/problems-using-python-with-editor-in-ue4/244763 "2021-08-10T07:07:03Z")\
**Posts on this page:** 1\
**Showing post:** 5

<div class="post-metadata">

**Author:** ![HenryMa96](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@HenryMa96](https://forums.unrealengine.com/u/HenryMa96)\
**Post date:** [October 23, 2023, 10:07am UTC](https://forums.unrealengine.com/t/problems-using-python-with-editor-in-ue4/244763/5 "2023-10-23T10:07:22Z")

</div>

The threading Timer may result in “not in game thread” issues.  
one possible solution is below: from [Python in Unreal Tips | Ryan DowlingSoka](https://ryandowlingsoka.com/unreal/python-in-unreal/)

```auto
class MyClass(object):
	def __init__ (self) -> None:
		self.frame_count = 0
		self.max_count = 1000

	def start(self) -> None:
		self.slate_post_tick_handle = unreal.register_slate_post_tick_callback(self.tick)
		self.frame_count = 0

	def tick(self, delta_time: float) -> None:
		print(self.frame_count)
		self.frame_count += 1
		if self.frame_count >= self.max_count:
			unreal.unregister_slate_post_tick_callback(self.slate_post_tick_handle)

test = MyClass()
test.start()

```

---

_[View the full topic](https://forums.unrealengine.com/t/problems-using-python-with-editor-in-ue4/244763)._
