Search code examples
pythonazurecortana-intelligenceazure-machine-learning-service

Is it possible to import python scripts in Azure?


I have a python script that is written in different files (one for importing, one for calculations, et cetera). These are all in the same folder, and when I need a function from another function I do something like

import file_import
file_import.do_something_usefull()

where, of course, in the file_import there is a function do_something_usefull() that, uhm, does something usefull. How can I accomplish the same in Azure?


Solution

  • I found it out myself. It is documenten on Microsoft's site here.

    The steps, very short, are:

    1. Include all the python you want in a .zip
    2. Upload that zip as a dataset
    3. Drag the dataset as the third option parameter in the 'execute python'-block (example below)

    Example dragging zip to Python script

    1. execute said function by importing import Hello (the name of the file, not the zip) and running Hello.do_something_usefull()