Rpy2 crushing when running it multiple times in the same python script

I have a python script that I use with rpy2, however in my code I need to repeatedly use R code, I do so by using the rpy2.robjects() function.
I have noticed that the first run of the R code works perfectly, no errors and no crushes. However while going into the second loop, I get the following error:

Unable top open index 'my_index'. Please make sure that the correct prefix is specified and you have the permission to read these files. For example, if there are files '/opt/my_index.reads', '/opt/my_index.files' and etc, the index prefix should be specified as '/opt/my_index' without any suffix.
 File "/home/lishana/miniconda3/envs/qiime2-new/bin/yamas", line 8, in <module>
    sys.exit(main())
  File "/home/lishana/miniconda3/envs/qiime2-new/lib/python3.8/site-packages/yamas/__init__.py", line 123, in main
    continue_from(dataset_id,continue_path,data_type, args.verbose, specific_location)
  File "/home/lishana/miniconda3/envs/qiime2-new/lib/python3.8/site-packages/yamas/dataset_downloading.py", line 60, in continue_from
    visualization_continue(dataset_id,continue_path, data_type, verbose_print, specific_location)
  File "/home/lishana/miniconda3/envs/qiime2-new/lib/python3.8/site-packages/yamas/create_visualization.py", line 465, in visualization_continue
    metaphlan_extraction(reads_data, dataset_id)
  File "/home/lishana/miniconda3/envs/qiime2-new/lib/python3.8/site-packages/yamas/create_visualization.py", line 181, in metaphlan_extraction
    pathways(pathways_metaphlan_output, fastq_name, reads_data, "/home/lishana/pathways")
  File "/home/lishana/miniconda3/envs/qiime2-new/lib/python3.8/site-packages/yamas/pathways.py", line 250, in pathways
    robjects.r(r_code)
  File "/home/lishana/miniconda3/envs/qiime2-new/lib/python3.8/site-packages/rpy2/robjects/__init__.py", line 509, in __call__
    res, visible = rinterface.evalr_expr_with_visible(   # type: ignore
  File "/home/lishana/miniconda3/envs/qiime2-new/lib/python3.8/site-packages/rpy2/rinterface.py", line 192, in evalr_expr_with_visible
    raise embedded.RRuntimeError(_rinterface._geterrmessage())
rpy2.rinterface_lib.embedded.RRuntimeError: Error in .stop_quietly() :

Now I know the problem that crushed the R code is presented in the beginning of the error message, however after rerunning the script it works, and crushes on the next loop (I have an if statement to not run the R code on something I run it on)
The line that the code is crushing on is the following:

if (readfile2 != "") {{
    align(index = "my_index", readfile1 = readfile1, readfile2 = readfile2, type = "rna", output_file = file.path(folder_path, "aligned_reads.bam"))
}} else {{
    align(index = "my_index", readfile1 = readfile1, type = "rna", output_file = file.path(folder_path, "aligned_reads.bam"))
}}

Couple extra notes:

  1. In the code I have an option to check if a library has already been called for, and if it has been it will not call it again to save time – the error happened before I implemented that.
  2. I delete the aligned_reads.bam after each iteration of the loop, and I save it each time in a different location.

anyone knows how to resolve this?
thanks!!

Trang chủ Giới thiệu Sinh nhật bé trai Sinh nhật bé gái Tổ chức sự kiện Biểu diễn giải trí Dịch vụ khác Trang trí tiệc cưới Tổ chức khai trương Tư vấn dịch vụ Thư viện ảnh Tin tức - sự kiện Liên hệ Chú hề sinh nhật Trang trí YEAR END PARTY công ty Trang trí tất niên cuối năm Trang trí tất niên xu hướng mới nhất Trang trí sinh nhật bé trai Hải Đăng Trang trí sinh nhật bé Khánh Vân Trang trí sinh nhật Bích Ngân Trang trí sinh nhật bé Thanh Trang Thuê ông già Noel phát quà Biểu diễn xiếc khỉ Xiếc quay đĩa Dịch vụ tổ chức sự kiện 5 sao Thông tin về chúng tôi Dịch vụ sinh nhật bé trai Dịch vụ sinh nhật bé gái Sự kiện trọn gói Các tiết mục giải trí Dịch vụ bổ trợ Tiệc cưới sang trọng Dịch vụ khai trương Tư vấn tổ chức sự kiện Hình ảnh sự kiện Cập nhật tin tức Liên hệ ngay Thuê chú hề chuyên nghiệp Tiệc tất niên cho công ty Trang trí tiệc cuối năm Tiệc tất niên độc đáo Sinh nhật bé Hải Đăng Sinh nhật đáng yêu bé Khánh Vân Sinh nhật sang trọng Bích Ngân Tiệc sinh nhật bé Thanh Trang Dịch vụ ông già Noel Xiếc thú vui nhộn Biểu diễn xiếc quay đĩa Dịch vụ tổ chức tiệc uy tín Khám phá dịch vụ của chúng tôi Tiệc sinh nhật cho bé trai Trang trí tiệc cho bé gái Gói sự kiện chuyên nghiệp Chương trình giải trí hấp dẫn Dịch vụ hỗ trợ sự kiện Trang trí tiệc cưới đẹp Khởi đầu thành công với khai trương Chuyên gia tư vấn sự kiện Xem ảnh các sự kiện đẹp Tin mới về sự kiện Kết nối với đội ngũ chuyên gia Chú hề vui nhộn cho tiệc sinh nhật Ý tưởng tiệc cuối năm Tất niên độc đáo Trang trí tiệc hiện đại Tổ chức sinh nhật cho Hải Đăng Sinh nhật độc quyền Khánh Vân Phong cách tiệc Bích Ngân Trang trí tiệc bé Thanh Trang Thuê dịch vụ ông già Noel chuyên nghiệp Xem xiếc khỉ đặc sắc Xiếc quay đĩa thú vị
Trang chủ Giới thiệu Sinh nhật bé trai Sinh nhật bé gái Tổ chức sự kiện Biểu diễn giải trí Dịch vụ khác Trang trí tiệc cưới Tổ chức khai trương Tư vấn dịch vụ Thư viện ảnh Tin tức - sự kiện Liên hệ Chú hề sinh nhật Trang trí YEAR END PARTY công ty Trang trí tất niên cuối năm Trang trí tất niên xu hướng mới nhất Trang trí sinh nhật bé trai Hải Đăng Trang trí sinh nhật bé Khánh Vân Trang trí sinh nhật Bích Ngân Trang trí sinh nhật bé Thanh Trang Thuê ông già Noel phát quà Biểu diễn xiếc khỉ Xiếc quay đĩa
Thiết kế website Thiết kế website Thiết kế website Cách kháng tài khoản quảng cáo Mua bán Fanpage Facebook Dịch vụ SEO Tổ chức sinh nhật