Say I have a function foo in a big Python project that has a named argument bar:This function is called a lot in the codebase, in calls that use or omit the named bar parameter.
Here:we get: 'exists'. Why not 'foo'? Which attribute would give 'foo'?You can view import foo as bar as just an assignment. You would not expect a function to change its name when you assign another name to it.
In situations where you want to import a nested module into your namespace, I've always written it like this: