How to call external functions from a PHP script in a WordPress plugin?

Generally we use shortcodes when we have to do something in WordPress posts and pages. Though they can also be used elsewhere. Assuming that you know how to use shortcodes here is what you might want to do:-

<?php
/**
 * Plugin Name: Learning To Code WordPress
 */

defined('ABSPATH') or die("No script kiddies please!");

require_once ( dirname(__FILE__) . "/download.php");

add_shortcode ('dloader', 'download_file');
function download_file($atts) { 

    /* Default filename. */
    $default['filename'] = 'defaultFileName.txt';
    /* Default time. */
    $default['time'] = 0;
    /* Default user id. */
    $default['ban_user_id'] = 1;

    $atts = shortcode_atts( $default , $atts, 'dloader' );

    $filename = $atts['filename'];
    $time = $atts['time'];
    $ban_user_id = $atts['ban_user_id'];

    return download($filename, $time, $ban_user_id);

}

Now use the shortcode in a post or a page like this:-

[dloader filename="abc.txt" time=10 ban_user_id=1]