Scripts with same name, possible? Gdscript

Godot Version

4.2.1

Question

Is there any way to create scripts with the same name in GDScript? For example, I want a script that represents pieces on a board, and another script that represents pieces on the board but in the level creation system.

So that’s the question, is there any way to create scripts with the same name? with different code of course.

1 Like

I don’t think so, but if you do it will automatically name it script (1), so that’s a way I guess.

Sure, that’s no problem (in different folders of course). You can easily separate them with a different class_name.

2 Likes

A big mistake of mine, I tried to create the same script in the same folder, I didn’t pay attention to that, there is no need to put a class_name in the script. Well, it helps someone in the future if they have the same problem or doubts!

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.