Skip to main content

is_module_level_function

Determines whether a given object is a function defined at the module level by checking its type and qualified name.

def is_module_level_function(
func: callable
) - > boolean

Determines if a given function is defined at the module level rather than being a builtin, a method, or a nested local function.

Parameters

NameTypeDescription
funccallableThe function object to be inspected for its definition scope.

Returns

TypeDescription
booleanTrue if the function is a user-defined function defined at the module scope, False otherwise.