Skip to contents

A module such as utils/data_handling.py is not a script: it defines functions for the scripts that import it, and run on its own it does nothing, or fails on code meant to run only when imported. Like an R script another script source()s, such a file is not run on its own. A file with an if __name__ == "__main__": block is a script too, and still runs.

Usage

.repro_py_imported(code_text_list, paths = NULL)

Arguments

code_text_list

named list of the Python files' code (names are file names)

paths

the files' paths in the package (same order), for dotted imports (from utils.data_handling import x); NULL uses the names

Value

a named list: for each imported file, the files that import it