import math as maths creates a local alias maths only in your current namespace.
It does not globally rename the module math to maths.
So when you write from maths import factorial, Python looks for a module named maths in your file system or installed packages, and can't find one — hence:
ModuleNotFoundError: No module named 'maths'
If you want to use an alias and access functions directly, do:
from math import factorial as fact print(fact(5))