Can I import a custom Python Module?

If I’m creating a Custom Component, can I import a custom Python module (by the import statement to the Component’s code) in the free version of PL? If so, where should I place the custom module file(s) on my local machine?

Hi @danaf

Someone from PL will no doubt add detail but:

In the code for a component I added an import statement before the class definition

  • I know the package (wget) was not already imported by PL because I only installed it yesterday
  • If the package doesn’t exist an error is generated (I mistyped it as “wgt” and got “!” and messages)
  • With the right package name, I was then able to run the model (even though I didn’t use any imported function)

So, I think you just import as usual…

If you are asking where to install the packages, then they should be in the python environment where PerceptiLabs is installed, so wherever you did pip install perceptilabs you would do pip install custom_python_module (except: packages can contain multiple modules but often one package contains only one module so they’re almost synonymous… I’m not very good at this package management stuff - if anyone else knows better I’m sure they’ll put us right promptly!)

I’ve just realised you’ve been a member here longer than I have - but you’re quieter :wink: What are you up to in ML, what’s the weather like where you are, etc. etc. etc.? Are you interested in joining a few of us online for coffee/chat via Slack sometime?

1 Like

Thanks, I’ll check it out.

I’m part of the technical marketing team at PL. I write the PL docs and other content. Every now and then I think of an outlier question, in this case, I’m trying to figure out if I can incorporate Qualcomm’s AIMET ( TensorFlow plugin into a Custom component.

As for the weather, I’m near Vancouver, British Columbia, and we just had a massive rainstorm that has caused mass flooding, with more rain in the forecast.

I poke my head into Slack every now and then :slight_smile: and enjoy all of the contributions you’ve made.