diff --git a/src/stubgen.py b/src/stubgen.py index 5bb9bf3b..7c08d2d2 100755 --- a/src/stubgen.py +++ b/src/stubgen.py @@ -388,7 +388,12 @@ def put_function(self, fn: Callable[..., Any], name: Optional[str] = None, paren # Check if this function is an alias from *another* module if name and fn_module and fn_module != self.module.__name__: - self.put_value(fn, name) + if parent is None: + self.put_value(fn, name) + else: + import_name = self.import_object(fn_module, fn.__name__) + self.write_ln(f"{name} = {import_name}\n") + return # Check if this function is an alias from the *same* module