Using a custom python function in a r package


I am working on implementing a new feature for my refinitiv package and I want to use a custom python function. However I don't want to create a global variable in my r package as the cran check does not like this.

reticulate::import_from_path( module = ""
                            ,  path = system.file("python/", package = "Refinitiv")
                            ,  delay_load = F, convert = F

fails with the following warning:

Error in py_module_import(module, convert = convert) : 
  ModuleNotFoundError: No module named 'refinitiv_utils'

however if I execute:

split_tupple_list <<- reticulate::source_python(system.file("python/"
                                                           , package = "Refinitiv"))

the function works without any issues.

the contents of the function

def split_tupple_list(x):
  return_list = [item[0] for item in x]
  return return_list

Any advice pls?

This topic was automatically closed 21 days after the last reply. New replies are no longer allowed.

If you have a query related to it or one of the replies, start a new topic and refer back with a link.