r"""Returns an iterable for all the modules within this module, including itself.
(self, **kwargs)
| 347 | ) |
| 348 | |
| 349 | def modules(self, **kwargs) -> "Iterable[Module]": |
| 350 | r"""Returns an iterable for all the modules within this module, including itself.""" |
| 351 | if "with_parent" in kwargs and kwargs["with_parent"]: |
| 352 | yield self, None |
| 353 | else: |
| 354 | yield self |
| 355 | yield from self._flatten(with_key=False, predicate=_is_module, **kwargs) |
| 356 | |
| 357 | def named_modules( |
| 358 | self, prefix: Optional[str] = None, **kwargs |