Skip to content

Unable to Access Function in Module from Start-RSJob #184

Description

@adamfortuno

I'm running PoshRSJob v1.7.4.4 on Powershell v5.1.15063.1029 on Windows 10.

I'm navigating to a folder named "Coffee.Application" with the following files:

  1. Coffee.Application.ps1
  2. Coffee.Application.psm1

I then run the following:

Start-RSJob -ScriptBlock { Get-CoffeeDBConnectionString } `
	-Name t1 `
	-ModulesToImport .\Coffee.Application.psm1

Receive-RSJob -Name t1

Receive-RSJob -Name t1, returns the following error:

The term 'Get-Foo' is not recognized as the name of a cmdlet, function, script file, or operable program. Check the spelling of the name, or if a path was included, verify that the path is correct and try again.

The function Get-Foo is in the module Coffee.Application. I expected the thread to be able to execute the Get-Foo function in the Coffee.Application module.

The module's script file is in the current workspace. I can load the module into the active session with the following:

import-module .\Coffee.Application.psm1

Once loaded, I can access any exposed functions.

I have tried closing all session. Starting a fresh session and making the call to Start-RSJob the first call made.

Activity

  1. MVKozlov commented on Jun 7, 2018

    @MVKozlov
    Contributor

    unlike Import-Module, -ModulesToImport parameter supports module name, but not module path.

    When commit #178 will be accepted it will work

  2. adamfortuno commented on Jun 8, 2018

    @adamfortuno
    Author

    If the function only accepts the module's name, do I need to keep the module's folder/files in the user or global module path?

  3. MVKozlov commented on Jun 8, 2018

    @MVKozlov
    Contributor

    Why did not you give yourself a chance to try ? ;-)

    ...both sopported.

  4. adamfortuno commented on Jun 8, 2018

    @adamfortuno
    Author

    That worked.

    Thank you @MVKozlov!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions