0

I'm importing modules into memory from a URL and throws it into the RAM using httpimport.

Consider the code:

url = '..........'
with httpimport.remote_repo(['myModels'], url):
    from myModels.EmployeeModel import DefaultEmployeeModel
myImportedModelInstance = DefaultEmployeeModel()

I have a

  • ZIP file that's called myModels.zip
  • and inside it there's a folder called myModels
  • and inside that folder there's a file called EmployeeModel that exports DefaultEmployeeModel

I want to support multiple HTTP Imports as above , but the myModels and DefaultEmployeeModel are hardcoded.

How can we do that dynamically , meaning inject myModels and inject DefaultEmployeeModel when needed ?

JAN
  • 20,056
  • 54
  • 170
  • 290
  • Have you seen this https://stackoverflow.com/questions/8718885/import-module-from-string-variable? – mx0 Mar 22 '22 at 15:37

0 Answers0