AttributeError: 'function' object has no attribute 'multiplicacion'
VS Code intelligence recognizes my path. Why I can’t use from src.business_logic.mis_funciones import multiplicacion as dt which would be the same that import src.business_logic.mis_funciones?
In order to preserve formatting, please select any code or traceback that you post and then click the </> button.
You have src.business_logic.mis_funciones.multiplicacion(2, 5). You’re calling multiplicacion, so it’s clearly a function.
Then you have from src.business_logic.mis_funciones import multiplicacion as dt. You’re importing the function multiplicacion but giving it the name dt.
When you write assert dt.multiplicacion(2, 5) == 10, you’re asking it to get the attribute multiplicacion of the function dt, but that function doesn’t have such an attribute.
As dt is the function, you should call it directly with assert dt(2, 5) == 10.
You can. But this means that dt is the name for the function that you imported. In the code, you try to use dt.multiplicacion, but that makes no sense. It means to look inside the thing named dt, to find its thing named multiplicacion. But it doesn’t work like that. dt is already the thing you want, and it doesn’t have anything named multiplicacion inside of it.