Variables can be declared that are passed externally with the annotation @morph.variables.

@morph.variables(
    var_name: str, default: Optional[Any] = None
)
def func_name(context):
	# write your code here

Parameters

name
string
required

Additional arguments can be added when executing functions.

You can pass arguments from an mdx file or specify arguments when executing a command.

default
any

Default value.

If not specified, the default value is None.

Example

@morph.func
@morph.variables("var1")
def get_data_from_database(context):
	var1_data = context.vars["var1"]
    # write your code here using var1_data
	return pd.DataFrame({})