Uncategorized

RStudio Import a python custom module into working envoirnment – RStudio IDE



Hi,

I have a python project that has the following setup

Folder
       --> main.py
       --> helper.py

I open up a new RStudio session and open the two files

# main.py

import pandas as pd
import janitor as jt
import helper as hl

# helper.py

def small_func():
  print("hello world")
  

When i run the main.py file i get the following


reticulate::repl_python()
Python 3.10.12 (C:/Users/user1/Miniconda3/envs/test-env/python.exe)
Reticulate 1.26 REPL -- A Python interpreter in R.
Enter 'exit' or 'quit' to exit the REPL and return to R.
>>> import helper as hl
ModuleNotFoundError: No module named 'helper'
>>> import pandas as pd
>>> import janitor as jt
>>> import helper as hl
ModuleNotFoundError: No module named 'helper'

Do i have to do something else in RStudio so my helper file will be seen?

Thanks



Source link

Leave a Reply

Your email address will not be published. Required fields are marked *