pwrs.core.feval_w_path#

pwrs.core.feval_w_path.feval_w_path(fpath, fname, *args, nargout=None)[source]#

Evaluate a function with an optional temporary search path.

Resolves and executes fname either from the current Python/MATPOWER dispatch environment or from the supplied directory path, temporarily adjusting the working directory and import path to mimic MATPOWER’s feval_w_path behavior.

Parameters:
  • fpath (str) – Directory path to add temporarily before resolving fname. Use an empty string to resolve in the current environment.

  • fname (str) – Function name to resolve and call.

  • *args – Positional arguments passed to the resolved function.

  • nargout (int, optional) – MATLAB compatibility flag controlling tuple slicing for multiple outputs.

Returns:

Function return value, or the leading nargout items when the underlying function returns a tuple.

Return type:

Any