At first glance I do not know why this would happen. But your post title mentions that you are using embedded Python - what distribution and version of Python are you using, exactly? I wonder if it could be something distribution specific.
Yes, this does the trick!
I did
from builtins import *
Apparently this is done implicitly with the interpreter and has to be done separately for embedded. Thank you . I am using Fedora core37, but that should not matter