Import function from other Python file

green
green New Altair Community Member
edited November 2024 in Community Q&A
I'm new to RapidMiner and I'm trying to use the Python Transfomer. I've been able to import libraries installed in my Anaconda environments. However, I want to import a function from another Python file (.py script) I have locally in my computer to be used in the Python Transformer. Is there any way I can do this?

Thanks in advance! Any help would be appreciated!

Best Answer

  • kayman
    kayman New Altair Community Member
    Answer ✓
    You can use sys to achieve this, then you just reference to the location of your script.

    like : 

    import sys
    sys.path.append('c:/some_folder/my_script')


Answers

  • kayman
    kayman New Altair Community Member
    Answer ✓
    You can use sys to achieve this, then you just reference to the location of your script.

    like : 

    import sys
    sys.path.append('c:/some_folder/my_script')


  • green
    green New Altair Community Member
    Works perfectly! Thank you so much!

Welcome!

It looks like you're new here. Sign in or register to get started.

Welcome!

It looks like you're new here. Sign in or register to get started.