Tilemap 4.0 use "create_scene_tile()" with packedscene from gdscript

:information_source: Attention Topic was automatically imported from the old Question2Answer platform.
:bust_in_silhouette: Asked By Blueberry

Hi all,

What I want to do:
I had the Idea to create a skilltree as a tilemap, to be able to easy add and remove “skills” while keeping them aligned.

Each skill is a scene with an own image (“skill_icon”), which needs to be adjusted for each of the scene. To save time, I created one skill scene and want to use it multiple times by putting it to the tilemap via code and assigning an icon.
I added the scene as a tileset => image.

Where I’m struggling:
I managed to create the scene, but as I want to use the same scene for all the tiles, I have to add the new tiles with a different image via gdscript. I found out that the function “create_scene_tile()” could do this, but I don’t know how to use it create_scene_tile doku. Calling it from “self” or from “tilemap” returns an error. Where is this function meant to be called?

My code so far:

var hex_tile_map: TileMap
var hex_skill_scene: PackedScene = preload("res://ui/HexSkill.tscn")

func _ready():
	hex_tile_map = $PanelContainer/HexTileMap
	
	for index in range(skillsData.size()):
		var skill = skillsData[str(index)]
		
            # Adjusting image for each scene instance
		hex_skill_scene.instantiate()
		hex_skill_scene.set("skill_icon", preload("res://src/assets/skills/' + str(skill.image) + '.png"))
		
		var new_scene_id = hex_tile_map.create_scene_tile(hex_skill_scene)
		hex_tile_map.set_cell(new_scene_id, Vector2i(skill.x_pos, skill.y_pos), 0, Vector2i(0, 0))

ERROR: None existing function “create_scene_tile()” in base TileMap

Any help is welcome