Declaring a function input parameter as module

Viewed 47

Say I have a function, where I want to declare an input parameter of type module, what should I chose?

Example:

collection/module_a.py

def inner_function():
  return 2

collection/module_b.py

def inner_function():
  return 3

app.py

from collection import module_a, module_b

def outer_function(parent_module):
    return parent_module.inner_function()

outer_function(module_a)
outer_function(module_b)

In the def outer_function: I would like to declare a type for the parent_module input parameter, preferably something from the typing library. But I struggle finding something that represents a module?

0 Answers
Related