While you of course may do as you think fit, I would like to mention to all others that IMHO it is not a good idea (to say at least) to go to the World Wide Web using root.
II know this is not a solution for the problem. Sorry about that.
I do not quite understand what your situation is. Is that terminal command (python) given from a terminal emulator running in a user GUI session? Or is the command given from a real console? Or is it given from a terminal emulator running in a root GUI session (which would of course be very bad berhaviour)?
And it seems that you think it should start Firefox. This means that some GUI session is also required. Now when you start this from a terminal as user in that user’s GUI, I do not see a problem for FF to be started in that same GUI session. (And you report that that works if I am correct).
But when you start this as a different user (root or other) inside or outside of a user’s GUI session, that will not work without further action. Because other users are not allowed to open windows in a GUI session not of their own (sounds logical, doesn’t it?)
And please, please, please, start every question/ptroblem description with the basic information about what you use. The openSUSE version is missing. Same for the DE you use in that GUI session.
i have a gui to configure ufw (a firewall) i launch it with xdg-su so i am in root (i think…) so in the code i can see the command is like i said in my last post