Remove extra lines of code!

Ps: Godot 4.2
Hello everyone, the situation is as follows: I have two scenes, on the first scene there is a button And on the second stage is Pop-up window. In the last post they helped me write the code, but the fact is that when I click on the button, my pop-up window appears and a second, but empty window appears behind it . I tried to remove the extra lines, this made the second window smaller, but I need it not to appear at all, can you help?`

extends TextureButton

@onready var PopUpScene:PackedScene = preload("res://сцены/параметры.tscn")
var popup:Control
var w: Popup
var view_port:Window
func _on_pressed():
		view_port=get_window()
		w=Popup.new()
		w.visible=true
		w.transient=true

		popup = PopUpScene.instantiate()
		popup.position=Vector2i(0,0)
		popup.size=w.size

		w.add_child(popup)
		w.close_requested.connect(func():w.hide())
		view_port.add_child(w)

The person, who helped you with the code, assumed that PopUpScene doesn’t have a PopUp node as the scene root. If the PopUpScene already has a PopUp node, you can try doing something like this:

const POPUPSCENE: PackedScene = preload("res://сцены/параметры.tscn")

func _on_pressed():
	var window = get_window()
	var popup = POPUPSCENE.instantiate()
	popup.position = Vector2i(0,0)
	popup.size = window.size / 2
	popup.close_requested.connect(popup.hide)
	window.add_child(popup)

If the popup has wrong size or position, you need to change the values of popup.position or popup.size to suit your needs.

Oh, forgive me for my mood :3 I forgot to show screenshots of the situation


![1711976394571|225x500](upload: