[Csnd] WARNING: perf-time code in global space, ignored

I've an opcode that rearrange a schedule in my terms:

    opcode eva_midi, 0, Siiiii
Sinstr, iwhen, idur, iamp, ienv, icps xin

if idur > giminnote && iamp > 0 then

    if (icps != 0) then
        ich init 1
        until ich > ginchnls do
            schedule Sinstr, iwhen, idur, iamp, ienv, icps, ich
            ich += 1
        od
    endif

endif
    endop

and when I make a csd with some code inside like this:

eva_midi "orphans4", 0, 2, 0.5, giiago, 440

I get this message:

WARNING: eva_midi: perf-time code in global space, ignored

At the end in the wav I render it seems that everything is fine.
I do not understand where's the problem/error? Am i doing something in the wrong way? Is it always better to put all schedules inside an instrument?

Csound mailing list
Csound@listserv.heanet.ie
https://listserv.heanet.ie/cgi-bin/wa?A0=CSOUND
Send bugs reports to
        Issues · csound/csound · GitHub
Discussions of bugs and features can be posted here

User defined opcodes are not pure init time blocks, even if there is nothing left for them to do after the init pass. By putting an opcode at the instr0 level you are placing performance code where it is not allowed. You can place bare "schedule" calls within the global space but a user-defined opcode needs to be called from within an instrument.

Thank you for your answer.

What I don’t understand is if it’s a suggestion or a “good practice”.
How this message impact performance or sound? As I said, csound says “ignored”, but at the end it compile the schedules.
Thank you.

I think you can safely ignore those warnings. All they say is that if you expected the code to run at
perf time, that won’t happen. But if you did, then there’s an issue.